Skip to content

Commit

Permalink
(maint) Add Windows preparation specs
Browse files Browse the repository at this point in the history
Adds spec tests for Windows-specific preparation, which primarily
involves retrieving the MSI when in a PE environment.
  • Loading branch information
Michael Smith committed Mar 24, 2016
1 parent e7b8f2a commit 25d476e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions spec/classes/puppet_agent_osfamily_windows_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'spec_helper'

describe 'puppet_agent' do
package_version = '1.2.5'
pe_version = '2000.0.0'

if Puppet.version >= '4.0.0'
let(:params) {{
:package_version => package_version
}}
end

before(:each) do
# Need to mock the PE functions
Puppet::Parser::Functions.newfunction(:pe_build_version, :type => :rvalue) do |args|
pe_version
end

Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, :type => :rvalue) do |args|
package_version
end
end

[['x64', 'x86_64'], ['x86', 'i386']].each do |arch, tag|
describe "supported Windows #{arch} environment" do
let(:appdata) { 'C:\ProgramData' }
let(:facts) {{
:is_pe => true,
:osfamily => 'windows',
:architecture => arch,
:servername => 'master.example.vm',
:clientcert => 'foo.example.vm',
:puppet_confdir => "#{appdata}\\Puppetlabs\\puppet\\etc",
:mco_confdir => "#{appdata}\\Puppetlabs\\mcollective\\etc",
:common_appdata => appdata,
}}

it { is_expected.to contain_file("#{appdata}\\Puppetlabs") }
it { is_expected.to contain_file("#{appdata}\\Puppetlabs\\packages") }
it {
is_expected.to contain_file("#{appdata}\\Puppetlabs\\packages/puppet-agent-#{arch}.msi").with(
'source' => "puppet:///pe_packages/#{pe_version}/windows-#{tag}/puppet-agent-#{arch}.msi"
)
}
end
end
end

0 comments on commit 25d476e

Please sign in to comment.