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 22, 2016
1 parent fe3e73d commit d7ecf61
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/classes/puppet_agent_osfamily_windows_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'spec_helper'

describe 'puppet_agent', :unless => Puppet.version < "3.8.0" || Puppet.version >= "4.0.0" do
before(:each) do
# Need to mock the PE functions
Puppet::Parser::Functions.newfunction(:pe_build_version, :type => :rvalue) do |args|
"4.0.0"
end

Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, :type => :rvalue) do |args|
'1.2.5'
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/4.0.0/windows-#{tag}/puppet-agent-#{arch}.msi"
)
}
end
end
end

0 comments on commit d7ecf61

Please sign in to comment.