beaker 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/HISTORY.md +699 -2
- data/acceptance/lib/beaker/acceptance/install_utils.rb +58 -0
- data/acceptance/pre_suite/puppet_gem/install.rb +1 -8
- data/acceptance/pre_suite/puppet_git/install.rb +6 -65
- data/acceptance/pre_suite/puppet_pkg/install.rb +1 -1
- data/acceptance/tests/foss_utils/clone_git_repo_on.rb +49 -0
- data/beaker.gemspec +2 -0
- data/lib/beaker/command.rb +1 -1
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +8 -6
- data/lib/beaker/dsl/helpers/web_helpers.rb +2 -1
- data/lib/beaker/dsl/install_utils/aio_defaults.rb +0 -3
- data/lib/beaker/dsl/install_utils/foss_defaults.rb +19 -0
- data/lib/beaker/dsl/install_utils/foss_utils.rb +164 -67
- data/lib/beaker/dsl/install_utils/pe_defaults.rb +9 -11
- data/lib/beaker/dsl/install_utils/pe_utils.rb +48 -64
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +43 -0
- data/lib/beaker/dsl/install_utils/windows_utils.rb +144 -0
- data/lib/beaker/dsl/roles.rb +20 -3
- data/lib/beaker/dsl/structure.rb +14 -3
- data/lib/beaker/host/freebsd/pkg.rb +18 -0
- data/lib/beaker/host/freebsd.rb +2 -0
- data/lib/beaker/host/unix/exec.rb +3 -3
- data/lib/beaker/host/unix/pkg.rb +37 -0
- data/lib/beaker/host/windows/exec.rb +3 -0
- data/lib/beaker/host.rb +38 -9
- data/lib/beaker/host_prebuilt_steps.rb +21 -11
- data/lib/beaker/hypervisor/aws_sdk.rb +22 -18
- data/lib/beaker/hypervisor/docker.rb +7 -0
- data/lib/beaker/hypervisor/openstack.rb +1 -0
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +10 -5
- data/lib/beaker/hypervisor/vmpooler.rb +4 -0
- data/lib/beaker/logger.rb +12 -1
- data/lib/beaker/options/command_line_parser.rb +9 -0
- data/lib/beaker/options/options_hash.rb +3 -296
- data/lib/beaker/options/parser.rb +12 -0
- data/lib/beaker/options/presets.rb +0 -1
- data/lib/beaker/platform.rb +3 -1
- data/lib/beaker/ssh_connection.rb +48 -23
- data/lib/beaker/test_case.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +0 -1
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +10 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +247 -49
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +116 -26
- data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +57 -0
- data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +132 -0
- data/spec/beaker/dsl/roles_spec.rb +36 -5
- data/spec/beaker/dsl/structure_spec.rb +9 -2
- data/spec/beaker/host/unix/pkg_spec.rb +26 -6
- data/spec/beaker/host_prebuilt_steps_spec.rb +3 -2
- data/spec/beaker/host_spec.rb +24 -6
- data/spec/beaker/hypervisor/aixer_spec.rb +1 -1
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +595 -58
- data/spec/beaker/hypervisor/docker_spec.rb +2 -1
- data/spec/beaker/hypervisor/solaris_spec.rb +1 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +20 -5
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +1 -1
- data/spec/beaker/logger_spec.rb +39 -0
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/options_hash_spec.rb +1 -102
- data/spec/beaker/options/parser_spec.rb +19 -0
- data/spec/beaker/options/pe_version_scaper_spec.rb +11 -1
- data/spec/beaker/options/presets_spec.rb +8 -0
- data/spec/beaker/ssh_connection_spec.rb +39 -21
- data/spec/helpers.rb +9 -3
- data/spec/mocks.rb +2 -0
- metadata +35 -11
- data/lib/beaker/answers/version20.rb +0 -120
- data/lib/beaker/answers/version28.rb +0 -121
- data/lib/beaker/answers/version30.rb +0 -227
- data/lib/beaker/answers/version32.rb +0 -44
- data/lib/beaker/answers/version34.rb +0 -51
- data/lib/beaker/answers/version38.rb +0 -29
- data/lib/beaker/answers/version40.rb +0 -44
- data/lib/beaker/answers.rb +0 -143
- data/spec/beaker/answers_spec.rb +0 -547
|
@@ -16,10 +16,11 @@ end
|
|
|
16
16
|
describe ClassMixedWithDSLInstallUtils do
|
|
17
17
|
let(:metadata) { @metadata ||= {} }
|
|
18
18
|
let(:presets) { Beaker::Options::Presets.new }
|
|
19
|
-
let(:opts) { presets.presets.merge(presets.env_vars) }
|
|
19
|
+
let(:opts) { presets.presets.merge(presets.env_vars).merge({ :type => 'foss' }) }
|
|
20
20
|
let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
:platform => 'linux',
|
|
22
|
+
:roles => [ 'agent' ],
|
|
23
|
+
:type => 'foss' }, 4 ) }
|
|
23
24
|
let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
|
|
24
25
|
basic_hosts[1][:platform] = 'windows'
|
|
25
26
|
basic_hosts[2][:platform] = 'osx-10.9-x86_64'
|
|
@@ -29,66 +30,80 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
29
30
|
let(:winhost) { make_host( 'winhost', { :platform => 'windows',
|
|
30
31
|
:pe_ver => '3.0',
|
|
31
32
|
:working_dir => '/tmp',
|
|
33
|
+
:type => 'foss',
|
|
32
34
|
:is_cygwin => true} ) }
|
|
33
35
|
let(:winhost_non_cygwin) { make_host( 'winhost_non_cygwin', { :platform => 'windows',
|
|
34
36
|
:pe_ver => '3.0',
|
|
35
37
|
:working_dir => '/tmp',
|
|
38
|
+
:type => 'foss',
|
|
36
39
|
:is_cygwin => 'false' } ) }
|
|
37
40
|
let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
|
|
41
|
+
:pe_ver => '3.0',
|
|
42
|
+
:type => 'foss',
|
|
43
|
+
:working_dir => '/tmp' } ) }
|
|
44
|
+
let(:freebsdhost9) { make_host( 'freebsdhost9', { :platform => 'freebsd-9-x64',
|
|
45
|
+
:pe_ver => '3.0',
|
|
46
|
+
:working_dir => '/tmp' } ) }
|
|
47
|
+
let(:freebsdhost10) { make_host( 'freebsdhost10', { :platform => 'freebsd-10-x64',
|
|
38
48
|
:pe_ver => '3.0',
|
|
39
49
|
:working_dir => '/tmp' } ) }
|
|
40
50
|
let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
|
|
41
51
|
:pe_ver => '3.0',
|
|
42
52
|
:working_dir => '/tmp',
|
|
53
|
+
:type => 'foss',
|
|
43
54
|
:dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386' } ) }
|
|
44
55
|
let(:eoshost) { make_host( 'eoshost', { :platform => 'eos',
|
|
45
56
|
:pe_ver => '3.0',
|
|
46
57
|
:working_dir => '/tmp',
|
|
58
|
+
:type => 'foss',
|
|
47
59
|
:dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
|
|
60
|
+
let(:win_temp) { 'C:\\Windows\\Temp' }
|
|
48
61
|
|
|
49
62
|
|
|
50
63
|
context '#configure_foss_defaults_on' do
|
|
51
|
-
it 'uses aio paths for hosts
|
|
64
|
+
it 'uses aio paths for hosts with role aio' do
|
|
52
65
|
hosts.each do |host|
|
|
53
|
-
host[:
|
|
66
|
+
host[:pe_ver] = nil
|
|
67
|
+
host[:version] = nil
|
|
68
|
+
host[:roles] = host[:roles] | ['aio']
|
|
54
69
|
end
|
|
70
|
+
expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
|
|
55
71
|
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
|
56
72
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
|
57
73
|
|
|
58
74
|
subject.configure_foss_defaults_on( hosts )
|
|
59
75
|
end
|
|
60
76
|
|
|
61
|
-
it 'uses
|
|
77
|
+
it 'uses no paths for hosts with no type' do
|
|
62
78
|
hosts.each do |host|
|
|
63
|
-
host[:type] =
|
|
79
|
+
host[:type] = nil
|
|
64
80
|
end
|
|
65
|
-
expect(subject).to receive(:
|
|
66
|
-
expect(subject).to receive(:
|
|
81
|
+
expect(subject).to receive(:add_aio_defaults_on).never
|
|
82
|
+
expect(subject).to receive(:add_foss_defaults_on).never
|
|
83
|
+
expect(subject).to receive(:add_puppet_paths_on).never
|
|
67
84
|
|
|
68
85
|
subject.configure_foss_defaults_on( hosts )
|
|
69
86
|
end
|
|
70
87
|
|
|
71
|
-
it 'uses
|
|
72
|
-
|
|
88
|
+
it 'uses aio paths for hosts with aio type (backwards compatability)' do
|
|
89
|
+
hosts.each do |host|
|
|
90
|
+
host[:type] = 'aio'
|
|
91
|
+
end
|
|
92
|
+
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
|
93
|
+
expect(subject).to receive(:add_foss_defaults_on).never
|
|
73
94
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
|
74
95
|
|
|
75
96
|
subject.configure_foss_defaults_on( hosts )
|
|
76
97
|
end
|
|
77
98
|
|
|
78
|
-
it 'uses aio paths for hosts of version >= 4.0
|
|
79
|
-
agents = []
|
|
80
|
-
not_agents = []
|
|
99
|
+
it 'uses aio paths for hosts of version >= 4.0' do
|
|
81
100
|
hosts.each do |host|
|
|
82
101
|
host[:version] = '4.0'
|
|
83
102
|
host[:pe_ver] = nil
|
|
84
|
-
|
|
85
|
-
agents << host
|
|
86
|
-
else
|
|
87
|
-
not_agents << host
|
|
88
|
-
end
|
|
103
|
+
host[:roles] = host[:roles] - ['aio']
|
|
89
104
|
end
|
|
90
|
-
expect(subject).to receive(:add_aio_defaults_on).exactly(
|
|
91
|
-
expect(subject).to receive(:add_foss_defaults_on).exactly(
|
|
105
|
+
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
|
106
|
+
expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
|
|
92
107
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
|
93
108
|
|
|
94
109
|
subject.configure_foss_defaults_on( hosts )
|
|
@@ -97,8 +112,23 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
97
112
|
it 'uses foss paths for hosts of version < 4.0' do
|
|
98
113
|
hosts.each do |host|
|
|
99
114
|
host[:version] = '3.8'
|
|
115
|
+
host[:pe_ver] = nil
|
|
116
|
+
end
|
|
117
|
+
expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
|
|
118
|
+
expect(subject).to receive(:add_aio_defaults_on).never
|
|
119
|
+
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
|
120
|
+
|
|
121
|
+
subject.configure_foss_defaults_on( hosts )
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'uses foss paths for foss-like type foss-package' do
|
|
125
|
+
hosts.each do |host|
|
|
126
|
+
host[:type] = 'foss-package'
|
|
127
|
+
host[:version] = '3.8'
|
|
128
|
+
host[:pe_ver] = nil
|
|
100
129
|
end
|
|
101
130
|
expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
|
|
131
|
+
expect(subject).to receive(:add_aio_defaults_on).never
|
|
102
132
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
|
103
133
|
|
|
104
134
|
subject.configure_foss_defaults_on( hosts )
|
|
@@ -106,6 +136,54 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
106
136
|
|
|
107
137
|
end
|
|
108
138
|
|
|
139
|
+
context 'lookup_in_env' do
|
|
140
|
+
it 'returns a default properly' do
|
|
141
|
+
env_var = subject.lookup_in_env('noway', 'nonesuch', 'returnme')
|
|
142
|
+
expect(env_var).to be == 'returnme'
|
|
143
|
+
env_var = subject.lookup_in_env('noway', nil, 'returnme')
|
|
144
|
+
expect(env_var).to be == 'returnme'
|
|
145
|
+
end
|
|
146
|
+
it 'finds correct env variable' do
|
|
147
|
+
allow(ENV).to receive(:[]).with(nil).and_return(nil)
|
|
148
|
+
allow(ENV).to receive(:[]).with('REALLYNONE').and_return(nil)
|
|
149
|
+
allow(ENV).to receive(:[]).with('NONESUCH').and_return('present')
|
|
150
|
+
allow(ENV).to receive(:[]).with('NOWAY_PROJ_NONESUCH').and_return('exists')
|
|
151
|
+
env_var = subject.lookup_in_env('nonesuch', 'noway-proj', 'fail')
|
|
152
|
+
expect(env_var).to be == 'exists'
|
|
153
|
+
env_var = subject.lookup_in_env('nonesuch')
|
|
154
|
+
expect(env_var).to be == 'present'
|
|
155
|
+
env_var = subject.lookup_in_env('reallynone')
|
|
156
|
+
expect(env_var).to be == nil
|
|
157
|
+
env_var = subject.lookup_in_env('reallynone',nil,'default')
|
|
158
|
+
expect(env_var).to be == 'default'
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
context 'build_giturl' do
|
|
163
|
+
it 'returns urls properly' do
|
|
164
|
+
allow(ENV).to receive(:[]).with('SERVER').and_return(nil)
|
|
165
|
+
allow(ENV).to receive(:[]).with('FORK').and_return(nil)
|
|
166
|
+
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return(nil)
|
|
167
|
+
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return(nil)
|
|
168
|
+
url = subject.build_giturl('puppet')
|
|
169
|
+
expect(url).to be == 'https://github.com/puppetlabs/puppet.git'
|
|
170
|
+
url = subject.build_giturl('puppet', 'er0ck')
|
|
171
|
+
expect(url).to be == 'https://github.com/er0ck/puppet.git'
|
|
172
|
+
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
|
|
173
|
+
expect(url).to be == 'https://bitbucket.com/er0ck-puppet.git'
|
|
174
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
|
|
175
|
+
expect(url).to be == 'https://github.com/er0ck/puppet.git'
|
|
176
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
|
|
177
|
+
expect(url).to be == 'https://github.com/er0ck/puppet.git'
|
|
178
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
|
|
179
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
|
180
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
|
|
181
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
|
182
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
|
|
183
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
109
187
|
context 'extract_repo_info_from' do
|
|
110
188
|
[{ :protocol => 'git', :path => 'git://github.com/puppetlabs/project.git' },
|
|
111
189
|
{ :protocol => 'ssh', :path => 'git@github.com:puppetlabs/project.git' },
|
|
@@ -154,14 +232,30 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
154
232
|
end
|
|
155
233
|
end
|
|
156
234
|
|
|
235
|
+
context 'install_puppet_from_freebsd_ports_on' do
|
|
236
|
+
it 'installs puppet on FreeBSD 9' do
|
|
237
|
+
expect(freebsdhost9).to receive(:install_package).with('puppet')
|
|
238
|
+
|
|
239
|
+
subject.install_puppet_from_freebsd_ports_on( freebsdhost9, {} )
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it 'installs puppet on FreeBSD 10' do
|
|
243
|
+
expect(freebsdhost10).to receive(:install_package).with('sysutils/puppet')
|
|
244
|
+
|
|
245
|
+
subject.install_puppet_from_freebsd_ports_on( freebsdhost10, {} )
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
157
249
|
context 'install_puppet_from_msi' do
|
|
250
|
+
before :each do
|
|
251
|
+
expect(subject).to receive(:get_temp_path).and_return(win_temp)
|
|
252
|
+
end
|
|
158
253
|
|
|
159
254
|
it 'installs puppet on cygwin windows' do
|
|
160
255
|
allow(subject).to receive(:link_exists?).and_return( true )
|
|
161
|
-
|
|
162
|
-
expect(subject).to receive(:on).with(winhost, 'curl -O http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi')
|
|
256
|
+
expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.7.1.msi\" -O http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi")
|
|
163
257
|
expect(subject).to receive(:on).with(winhost, " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
|
164
|
-
expect(subject).to receive(:
|
|
258
|
+
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1.msi", {}, {:debug => nil})
|
|
165
259
|
|
|
166
260
|
subject.install_puppet_from_msi( winhost, {:version => '3.7.1', :win_download_url => 'http://downloads.puppetlabs.com/windows'} )
|
|
167
261
|
end
|
|
@@ -171,18 +265,18 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
171
265
|
|
|
172
266
|
expect(winhost_non_cygwin).to receive(:mkdir_p).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
|
173
267
|
|
|
174
|
-
expect(subject).to receive(:on) do |
|
|
268
|
+
expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of( Beaker::Command )) do |host, beaker_command|
|
|
175
269
|
expect(beaker_command.command).to eq('powershell.exe')
|
|
176
|
-
expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi','
|
|
177
|
-
end
|
|
270
|
+
expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')"])
|
|
271
|
+
end.once
|
|
178
272
|
|
|
179
|
-
expect(subject).to receive(:
|
|
273
|
+
expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {}, {:debug => nil})
|
|
180
274
|
|
|
181
275
|
subject.install_puppet_from_msi( winhost_non_cygwin, {:version => '3.7.1', :win_download_url => 'http://downloads.puppetlabs.com/windows'} )
|
|
182
276
|
end
|
|
183
277
|
end
|
|
184
278
|
|
|
185
|
-
context '
|
|
279
|
+
context 'clone_git_repo_on' do
|
|
186
280
|
it 'does a ton of stuff it probably shouldnt' do
|
|
187
281
|
repo = { :name => 'puppet',
|
|
188
282
|
:path => 'git://my.server.net/puppet.git',
|
|
@@ -194,11 +288,11 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
194
288
|
allow( subject ).to receive( :metadata ).and_return( metadata )
|
|
195
289
|
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
196
290
|
|
|
197
|
-
expect( subject ).to receive( :logger ).exactly(
|
|
198
|
-
expect( subject ).to receive( :on ).exactly(
|
|
291
|
+
expect( subject ).to receive( :logger ).exactly( 2 ).times.and_return( logger )
|
|
292
|
+
expect( subject ).to receive( :on ).exactly( 3 ).times
|
|
199
293
|
|
|
200
294
|
subject.instance_variable_set( :@metadata, {} )
|
|
201
|
-
subject.
|
|
295
|
+
subject.clone_git_repo_on( host, path, repo )
|
|
202
296
|
end
|
|
203
297
|
|
|
204
298
|
it 'allows a checkout depth of 1' do
|
|
@@ -213,15 +307,14 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
213
307
|
logger = double.as_null_object
|
|
214
308
|
allow( subject ).to receive( :metadata ).and_return( metadata )
|
|
215
309
|
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
216
|
-
expect( subject ).to receive( :logger ).exactly(
|
|
217
|
-
expect( subject ).to receive( :on ).with( host,"test -d #{path} || mkdir -p #{path}").exactly( 1 ).times
|
|
310
|
+
expect( subject ).to receive( :logger ).exactly( 2 ).times.and_return( logger )
|
|
311
|
+
expect( subject ).to receive( :on ).with( host, "test -d #{path} || mkdir -p #{path}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
218
312
|
# this is the the command we want to test
|
|
219
|
-
expect( subject ).to receive( :on ).with( host, cmd ).exactly( 1 ).times
|
|
220
|
-
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && git remote rm origin && git remote add origin #{repo[:path]} && git fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* && git clean -fdx && git checkout -f #{repo[:rev]}" ).exactly( 1 ).times
|
|
221
|
-
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && if [ -f install.rb ]; then ruby ./install.rb ; else true; fi" ).exactly( 1 ).times
|
|
313
|
+
expect( subject ).to receive( :on ).with( host, cmd, {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
314
|
+
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && git remote rm origin && git remote add origin #{repo[:path]} && git fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* && git clean -fdx && git checkout -f #{repo[:rev]}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
222
315
|
|
|
223
316
|
subject.instance_variable_set( :@metadata, {} )
|
|
224
|
-
subject.
|
|
317
|
+
subject.clone_git_repo_on( host, path, repo )
|
|
225
318
|
end
|
|
226
319
|
|
|
227
320
|
it 'allows a checkout depth with a rev from a specific branch' do
|
|
@@ -237,16 +330,57 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
237
330
|
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
238
331
|
logger = double.as_null_object
|
|
239
332
|
allow( subject ).to receive( :metadata ).and_return( metadata )
|
|
240
|
-
expect( subject ).to receive( :logger ).exactly(
|
|
241
|
-
expect( subject ).to receive( :on ).with( host,"test -d #{path} || mkdir -p #{path}").exactly( 1 ).times
|
|
333
|
+
expect( subject ).to receive( :logger ).exactly( 2 ).times.and_return( logger )
|
|
334
|
+
expect( subject ).to receive( :on ).with( host, "test -d #{path} || mkdir -p #{path}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
242
335
|
# this is the the command we want to test
|
|
243
|
-
expect( subject ).to receive( :on ).with( host, cmd ).exactly( 1 ).times
|
|
244
|
-
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && git remote rm origin && git remote add origin #{repo[:path]} && git fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* && git clean -fdx && git checkout -f #{repo[:rev]}" ).exactly( 1 ).times
|
|
245
|
-
|
|
336
|
+
expect( subject ).to receive( :on ).with( host, cmd, {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
337
|
+
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && git remote rm origin && git remote add origin #{repo[:path]} && git fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* && git clean -fdx && git checkout -f #{repo[:rev]}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
338
|
+
|
|
339
|
+
subject.instance_variable_set( :@metadata, {} )
|
|
340
|
+
subject.clone_git_repo_on( host, path, repo )
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
context 'install_from_git' do
|
|
345
|
+
it 'does a ton of stuff it probably shouldnt' do
|
|
346
|
+
repo = { :name => 'puppet',
|
|
347
|
+
:path => 'git://my.server.net/puppet.git',
|
|
348
|
+
:rev => 'master' }
|
|
349
|
+
path = '/path/to/repos'
|
|
350
|
+
host = { 'platform' => 'debian' }
|
|
351
|
+
logger = double.as_null_object
|
|
352
|
+
|
|
353
|
+
allow( subject ).to receive( :metadata ).and_return( metadata )
|
|
354
|
+
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
355
|
+
|
|
356
|
+
expect( subject ).to receive( :logger ).exactly( 3 ).times.and_return( logger )
|
|
357
|
+
expect( subject ).to receive( :on ).exactly( 4 ).times
|
|
246
358
|
|
|
247
359
|
subject.instance_variable_set( :@metadata, {} )
|
|
248
360
|
subject.install_from_git( host, path, repo )
|
|
249
361
|
end
|
|
362
|
+
|
|
363
|
+
it 'should attempt to install ruby code' do
|
|
364
|
+
repo = { :name => 'puppet',
|
|
365
|
+
:path => 'git://my.server.net/puppet.git',
|
|
366
|
+
:rev => 'master',
|
|
367
|
+
:depth => 1 }
|
|
368
|
+
|
|
369
|
+
path = '/path/to/repos'
|
|
370
|
+
cmd = "test -d #{path}/#{repo[:name]} || git clone --branch #{repo[:rev]} --depth #{repo[:depth]} #{repo[:path]} #{path}/#{repo[:name]}"
|
|
371
|
+
host = { 'platform' => 'debian' }
|
|
372
|
+
logger = double.as_null_object
|
|
373
|
+
allow( subject ).to receive( :metadata ).and_return( metadata )
|
|
374
|
+
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
375
|
+
expect( subject ).to receive( :logger ).exactly( 3 ).times.and_return( logger )
|
|
376
|
+
expect( subject ).to receive( :on ).with( host, "test -d #{path} || mkdir -p #{path}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
377
|
+
expect( subject ).to receive( :on ).with( host, cmd, {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
378
|
+
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && git remote rm origin && git remote add origin #{repo[:path]} && git fetch origin +refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* && git clean -fdx && git checkout -f #{repo[:rev]}", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
379
|
+
expect( subject ).to receive( :on ).with( host, "cd #{path}/#{repo[:name]} && if [ -f install.rb ]; then ruby ./install.rb ; else true; fi", {:accept_all_exit_codes=>true} ).exactly( 1 ).times
|
|
380
|
+
|
|
381
|
+
subject.instance_variable_set( :@metadata, {} )
|
|
382
|
+
subject.install_from_git_on( host, path, repo )
|
|
383
|
+
end
|
|
250
384
|
end
|
|
251
385
|
|
|
252
386
|
describe '#install_puppet' do
|
|
@@ -317,19 +451,28 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
317
451
|
end
|
|
318
452
|
context 'on windows' do
|
|
319
453
|
let(:platform) { Beaker::Platform.new('windows-2008r2-i386') }
|
|
454
|
+
|
|
455
|
+
before :each do
|
|
456
|
+
expect(subject).to receive(:get_temp_path).exactly(hosts.length).times.and_return(win_temp)
|
|
457
|
+
end
|
|
458
|
+
|
|
320
459
|
it 'installs specific version of puppet when passed :version' do
|
|
321
460
|
allow(hosts[0]).to receive(:is_cygwin?).and_return(true)
|
|
322
461
|
allow(subject).to receive(:link_exists?).and_return( true )
|
|
323
|
-
expect(subject).to receive(:on).with(hosts[0],
|
|
462
|
+
expect(subject).to receive(:on).with(hosts[0], "curl -o \"#{win_temp}\\puppet-3.msi\" -O http://downloads.puppetlabs.com/windows/puppet-3.msi")
|
|
324
463
|
expect(subject).to receive(:on).with(hosts[0], " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
|
325
|
-
expect(subject).to receive(:
|
|
464
|
+
expect(subject).to receive(:install_msi_on).with(hosts[0], "#{win_temp}\\puppet-3.msi", {}, {:debug => nil}).exactly(1).times
|
|
465
|
+
allow(subject).to receive(:install_msi_on).with(any_args)
|
|
466
|
+
|
|
326
467
|
subject.install_puppet(:version => '3')
|
|
327
468
|
end
|
|
328
469
|
it 'installs from custom url when passed :win_download_url' do
|
|
329
470
|
allow(hosts[0]).to receive(:is_cygwin?).and_return(true)
|
|
330
471
|
allow(subject).to receive(:link_exists?).and_return( true )
|
|
331
|
-
expect(subject).to receive(:on).with(hosts[0],
|
|
332
|
-
expect(subject).to receive(:
|
|
472
|
+
expect(subject).to receive(:on).with(hosts[0], "curl -o \"#{win_temp}\\puppet-3.msi\" -O http://nightlies.puppetlabs.com/puppet-latest/repos/windows/puppet-3.msi")
|
|
473
|
+
expect(subject).to receive(:install_msi_on).with(hosts[0], "#{win_temp}\\puppet-3.msi", {}, {:debug => nil})
|
|
474
|
+
allow(subject).to receive(:install_msi_on).with(any_args)
|
|
475
|
+
|
|
333
476
|
subject.install_puppet( :version => '3', :win_download_url => 'http://nightlies.puppetlabs.com/puppet-latest/repos/windows' )
|
|
334
477
|
end
|
|
335
478
|
end
|
|
@@ -722,13 +865,14 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
722
865
|
host['platform'] = platform
|
|
723
866
|
opts = { :version => '0.1.0' }
|
|
724
867
|
allow( subject ).to receive( :options ).and_return( {} )
|
|
868
|
+
copied_path = "#{win_temp}\\puppet-agent-x64.msi"
|
|
725
869
|
mock_echo = Object.new()
|
|
726
|
-
allow( mock_echo ).to receive( :raw_output ).and_return(
|
|
870
|
+
allow( mock_echo ).to receive( :raw_output ).and_return( copied_path )
|
|
727
871
|
|
|
728
872
|
expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-x64.msi', /\/windows$/)
|
|
729
873
|
expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-x64.msi$/, /cygpath/)
|
|
874
|
+
expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, {:debug => nil}).once
|
|
730
875
|
expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
|
|
731
|
-
expect(subject).to receive(:on).ordered.with(host, anything)
|
|
732
876
|
|
|
733
877
|
subject.install_puppetagent_dev_repo( host, opts )
|
|
734
878
|
end
|
|
@@ -766,6 +910,25 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
766
910
|
end
|
|
767
911
|
end
|
|
768
912
|
|
|
913
|
+
describe '#install_puppet_agent_pe_promoted_repo_on' do
|
|
914
|
+
|
|
915
|
+
it 'splits the platform string version correctly to get ubuntu puppet-agent packages' do
|
|
916
|
+
platform = Object.new()
|
|
917
|
+
allow(platform).to receive(:to_array) { ['ubuntu', '9999', 'x42']}
|
|
918
|
+
host = basic_hosts.first
|
|
919
|
+
host['platform'] = platform
|
|
920
|
+
|
|
921
|
+
expect(subject).to receive(:fetch_http_file).once.with(/\/puppet-agent\//, "puppet-agent-ubuntu-99.99-x42.tar.gz", /ubuntu/)
|
|
922
|
+
expect(subject).to receive(:scp_to).once.with(host, /-ubuntu-99.99-x42\./, "/root")
|
|
923
|
+
expect(subject).to receive(:on).ordered.with(host, /^tar.*-ubuntu-99.99-x42/)
|
|
924
|
+
expect(subject).to receive(:on).ordered.with(host, /dpkg\ -i\ --force-all/)
|
|
925
|
+
expect(subject).to receive(:on).ordered.with(host, /apt-get\ update/)
|
|
926
|
+
|
|
927
|
+
subject.install_puppet_agent_pe_promoted_repo_on( host, {} )
|
|
928
|
+
end
|
|
929
|
+
|
|
930
|
+
end
|
|
931
|
+
|
|
769
932
|
describe '#install_cert_on_windows' do
|
|
770
933
|
before do
|
|
771
934
|
allow(subject).to receive(:on).and_return(Beaker::Result.new({},''))
|
|
@@ -812,4 +975,39 @@ describe ClassMixedWithDSLInstallUtils do
|
|
|
812
975
|
end
|
|
813
976
|
end
|
|
814
977
|
end
|
|
978
|
+
|
|
979
|
+
describe '#install_puppet_agent_pe_promoted_repo_on' do
|
|
980
|
+
let( :package_name ) { 'puppet-agent' }
|
|
981
|
+
let( :platform ) { @platform || 'other' }
|
|
982
|
+
let( :host ) do
|
|
983
|
+
FakeHost.create( 'fakvm', platform, opts )
|
|
984
|
+
end
|
|
985
|
+
|
|
986
|
+
before :each do
|
|
987
|
+
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
|
988
|
+
allow( subject ).to receive( :install_msi_on ).with( any_args )
|
|
989
|
+
end
|
|
990
|
+
|
|
991
|
+
def test_fetch_http_file_no_ending_slash(platform)
|
|
992
|
+
@platform = platform
|
|
993
|
+
allow( subject ).to receive( :scp_to )
|
|
994
|
+
allow( subject ).to receive( :configure_type_defaults_on ).with(host)
|
|
995
|
+
|
|
996
|
+
expect( subject ).to receive( :fetch_http_file ).with( /[^\/]\z/, anything, anything )
|
|
997
|
+
subject.install_puppet_agent_pe_promoted_repo_on( host, opts )
|
|
998
|
+
end
|
|
999
|
+
|
|
1000
|
+
context 'on windows' do
|
|
1001
|
+
|
|
1002
|
+
it 'calls fetch_http_file with no ending slash' do
|
|
1003
|
+
test_fetch_http_file_no_ending_slash( 'windows-7-x86_64' )
|
|
1004
|
+
end
|
|
1005
|
+
|
|
1006
|
+
end
|
|
1007
|
+
|
|
1008
|
+
it 'calls fetch_http_file with no ending slash' do
|
|
1009
|
+
test_fetch_http_file_no_ending_slash( 'debian-5-x86_64' )
|
|
1010
|
+
end
|
|
1011
|
+
|
|
1012
|
+
end
|
|
815
1013
|
end
|