-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(maint) Add Windows preparation specs
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |