-
Notifications
You must be signed in to change notification settings - Fork 193
/
puppet_agent_osfamily_darwin_spec.rb
84 lines (72 loc) · 2.88 KB
/
puppet_agent_osfamily_darwin_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require 'spec_helper'
describe 'puppet_agent' do
master_package_version = '1.10.100'
before(:each) do
# Need to mock the PE functions
Puppet::Parser::Functions.newfunction(:pe_build_version, :type => :rvalue) do |args|
"2000.0.0"
end
Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, :type => :rvalue) do |args|
master_package_version
end
end
package_version = '1.10.100'
let(:params) {{ package_version: package_version }}
facts = {
:is_pe => true,
:osfamily => 'Darwin',
:operatingsystem => 'Darwin',
:macosx_productversion_major => '10.9',
:architecture => 'x86_64',
:servername => 'master.example.vm',
:clientcert => 'foo.example.vm',
:env_temp_variable => '/tmp',
:puppet_agent_pid => 42
}
describe 'unsupported environment' do
context "when OSX 10.8" do
let(:facts) do
facts.merge({
:platform_tag => "osx-10.8-x86_64",
:macosx_productversion_major => '10.8',
})
end
it { expect { catalogue }.to raise_error(/not supported/) }
end
end
describe 'supported environment' do
context "when running a supported OSX" do
["osx-10.9-x86_64", "osx-10.10-x86_64", "osx-10.11-x86_64", "osx-10.12-x86_64", "osx-10.13-x86_64"].each do |tag|
context "on #{tag} with no aio_version" do
let(:osmajor) { tag.split('-')[1] }
let(:facts) do
facts.merge({
:is_pe => true,
:aio_agent_version => '1.10.99',
:platform_tag => tag,
:macosx_productversion_major => osmajor
})
end
it { should compile.with_all_deps }
it { is_expected.to contain_file('/opt/puppetlabs') }
it { is_expected.to contain_file('/opt/puppetlabs/packages') }
it { is_expected.to contain_file("/opt/puppetlabs/packages/puppet-agent-#{package_version}-1.osx#{osmajor}.dmg") }
it { is_expected.to contain_file('/tmp/osx_install.sh') }
it { is_expected.to contain_exec('osx_install script') }
it { is_expected.to contain_class('puppet_agent::install::remove_packages') }
it { is_expected.to contain_class('puppet_agent::install::remove_packages_osx') }
it { is_expected.to contain_class("puppet_agent::osfamily::darwin") }
context 'aio_agent_version is out of date' do
let(:facts) do
facts.merge({
:aio_agent_version => '0.0.1'
})
end
it { is_expected.not_to contain_exec('forget puppet-agent') }
end
it { is_expected.not_to contain_exec('forget puppet-agent') }
end
end
end
end
end