beaker-puppet 1.29.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +28 -7
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +842 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +5 -20
- data/Rakefile +64 -169
- data/acceptance/config/acceptance-options.rb +3 -3
- data/acceptance/config/gem/acceptance-options.rb +8 -8
- data/acceptance/config/git/acceptance-options.rb +8 -8
- data/acceptance/config/pkg/acceptance-options.rb +7 -7
- data/acceptance/pre_suite/gem/install.rb +6 -6
- data/acceptance/pre_suite/git/install.rb +22 -22
- data/acceptance/pre_suite/pkg/install.rb +3 -3
- data/acceptance/tests/backwards_compatible.rb +6 -7
- data/acceptance/tests/clone_git_repo_on_test.rb +12 -13
- data/acceptance/tests/create_tmpdir_on_test.rb +13 -9
- data/acceptance/tests/install_smoke_test.rb +5 -4
- data/acceptance/tests/stub_host.rb +11 -10
- data/acceptance/tests/web_helpers_test.rb +11 -10
- data/beaker-puppet.gemspec +16 -23
- data/bin/beaker-puppet +2 -4
- data/lib/beaker-puppet/helpers/facter_helpers.rb +9 -7
- data/lib/beaker-puppet/helpers/host_helpers.rb +10 -7
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +151 -160
- data/lib/beaker-puppet/helpers/rake_helpers.rb +1 -1
- data/lib/beaker-puppet/helpers/tk_helpers.rb +22 -28
- data/lib/beaker-puppet/install_utils/aio_defaults.rb +39 -43
- data/lib/beaker-puppet/install_utils/ezbake_utils.rb +34 -42
- data/lib/beaker-puppet/install_utils/foss_defaults.rb +134 -138
- data/lib/beaker-puppet/install_utils/foss_utils.rb +293 -320
- data/lib/beaker-puppet/install_utils/module_utils.rb +58 -70
- data/lib/beaker-puppet/install_utils/puppet5.rb +30 -35
- data/lib/beaker-puppet/install_utils/puppet_utils.rb +58 -68
- data/lib/beaker-puppet/install_utils/windows_utils.rb +34 -36
- data/lib/beaker-puppet/version.rb +1 -1
- data/lib/beaker-puppet/wrappers.rb +13 -14
- data/lib/beaker-puppet.rb +4 -5
- data/setup/aio/010_Install_Puppet_Agent.rb +5 -6
- data/setup/common/000-delete-puppet-when-none.rb +2 -4
- data/setup/common/003_solaris_cert_fix.rb +74 -70
- data/setup/common/005_redhat_subscription_fix.rb +3 -2
- data/setup/common/011_Install_Puppet_Server.rb +7 -9
- data/setup/common/012_Finalize_Installs.rb +5 -5
- data/setup/common/025_StopFirewall.rb +1 -1
- data/setup/common/030_StopSssd.rb +2 -2
- data/setup/common/040_ValidateSignCert.rb +10 -12
- data/setup/common/045_EnsureMasterStarted.rb +2 -2
- data/setup/gem/010_GemInstall.rb +5 -4
- data/setup/git/000_EnvSetup.rb +48 -48
- data/setup/git/010_TestSetup.rb +13 -12
- data/setup/git/020_PuppetUserAndGroup.rb +3 -2
- data/setup/git/060_InstallModules.rb +14 -14
- data/setup/git/070_InstallCACerts.rb +82 -82
- data/spec/beaker-puppet/helpers/facter_helpers_spec.rb +22 -24
- data/spec/beaker-puppet/helpers/host_helpers_spec.rb +10 -6
- data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +506 -517
- data/spec/beaker-puppet/helpers/tk_helpers_spec.rb +20 -24
- data/spec/beaker-puppet/install_utils/ezbake_utils_spec.rb +86 -90
- data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +636 -599
- data/spec/beaker-puppet/install_utils/module_utils_spec.rb +125 -116
- data/spec/beaker-puppet/install_utils/puppet5_spec.rb +159 -165
- data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +92 -77
- data/spec/beaker-puppet/install_utils/windows_utils_spec.rb +101 -89
- data/spec/beaker-puppet/wrappers_spec.rb +10 -10
- data/spec/helpers.rb +85 -91
- data/tasks/ci.rake +171 -179
- metadata +33 -62
- data/setup/common/020_InstallCumulusModules.rb +0 -13
- data/setup/common/021_InstallAristaModuleMasters.rb +0 -12
- data/setup/common/022_InstallAristaModuleAgents.rb +0 -13
@@ -17,90 +17,111 @@ end
|
|
17
17
|
describe ClassMixedWithDSLInstallUtils do
|
18
18
|
let(:metadata) { @metadata ||= {} }
|
19
19
|
let(:presets) { Beaker::Options::Presets.new }
|
20
|
-
let(:opts) { presets.presets.merge(presets.env_vars).merge({ :
|
21
|
-
let(:basic_hosts)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
let(:
|
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
|
-
let(:
|
20
|
+
let(:opts) { presets.presets.merge(presets.env_vars).merge({ type: 'foss' }) }
|
21
|
+
let(:basic_hosts) do
|
22
|
+
make_hosts({ pe_ver: '3.0',
|
23
|
+
platform: 'linux',
|
24
|
+
roles: ['agent'],
|
25
|
+
type: 'foss', }, 4)
|
26
|
+
end
|
27
|
+
let(:hosts) do
|
28
|
+
basic_hosts[0][:roles] = %w[master database dashboard]
|
29
|
+
basic_hosts[1][:platform] = 'windows'
|
30
|
+
basic_hosts[2][:platform] = 'osx-10.9-x86_64'
|
31
|
+
basic_hosts[3][:platform] = 'eos'
|
32
|
+
basic_hosts
|
33
|
+
end
|
34
|
+
let(:hosts_sorted) { [hosts[1], hosts[0], hosts[2], hosts[3]] }
|
35
|
+
let(:winhost) do
|
36
|
+
make_host('winhost', { platform: Beaker::Platform.new('windows-2008r2-64'),
|
37
|
+
pe_ver: '3.0',
|
38
|
+
working_dir: '/tmp',
|
39
|
+
type: 'foss',
|
40
|
+
is_cygwin: true, })
|
41
|
+
end
|
42
|
+
let(:winhost_non_cygwin) do
|
43
|
+
make_host('winhost_non_cygwin', { platform: 'windows',
|
44
|
+
pe_ver: '3.0',
|
45
|
+
working_dir: '/tmp',
|
46
|
+
type: 'foss',
|
47
|
+
is_cygwin: 'false', })
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:machost) do
|
51
|
+
make_host('machost', { platform: 'osx-10.9-x86_64',
|
52
|
+
pe_ver: '3.0',
|
53
|
+
type: 'foss',
|
54
|
+
working_dir: '/tmp', })
|
55
|
+
end
|
56
|
+
let(:freebsdhost12) do
|
57
|
+
make_host('freebsdhost12', { platform: 'freebsd-12-amd64',
|
58
|
+
pe_ver: '3.0',
|
59
|
+
working_dir: '/tmp', })
|
60
|
+
end
|
61
|
+
let(:freebsdhost13) do
|
62
|
+
make_host('freebsdhost13', { platform: 'freebsd-13-amd64',
|
63
|
+
pe_ver: '3.0',
|
64
|
+
working_dir: '/tmp', })
|
65
|
+
end
|
66
|
+
let(:unixhost) do
|
67
|
+
make_host('unixhost', { platform: 'linux',
|
68
|
+
pe_ver: '3.0',
|
69
|
+
working_dir: '/tmp',
|
70
|
+
type: 'foss',
|
71
|
+
dist: 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386', })
|
72
|
+
end
|
73
|
+
let(:eoshost) do
|
74
|
+
make_host('eoshost', { platform: 'eos',
|
75
|
+
pe_ver: '3.0',
|
76
|
+
working_dir: '/tmp',
|
77
|
+
type: 'foss',
|
78
|
+
dist: 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386', })
|
79
|
+
end
|
80
|
+
let(:el6hostaio) do
|
81
|
+
make_host('el6hostaio', { platform: Beaker::Platform.new('el-6-i386'),
|
82
|
+
pe_ver: '3.0',
|
83
|
+
working_dir: '/tmp',
|
84
|
+
type: 'aio',
|
85
|
+
dist: 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-centos-6-i386', })
|
86
|
+
end
|
87
|
+
let(:el6hostfoss) do
|
88
|
+
make_host('el6hostfoss', { platform: Beaker::Platform.new('el-6-i386'),
|
89
|
+
pe_ver: '3.0',
|
90
|
+
working_dir: '/tmp',
|
91
|
+
type: 'foss',
|
92
|
+
dist: 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-centos-6-i386', })
|
93
|
+
end
|
94
|
+
|
95
|
+
let(:win_temp) { 'C:\\Windows\\Temp' }
|
74
96
|
|
75
97
|
context '#sanitize_opts' do
|
76
|
-
let(:opts)
|
98
|
+
let(:opts) do
|
77
99
|
{
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
100
|
+
win_download_url: nil,
|
101
|
+
dev_builds_url: '',
|
102
|
+
release_yum_repo_url: 'https://apt.customserver.net/apt',
|
81
103
|
}
|
82
|
-
|
104
|
+
end
|
83
105
|
|
84
106
|
it 'honors any custom values' do
|
85
|
-
expect(
|
107
|
+
expect(subject.sanitize_opts(opts)).to include({ release_yum_repo_url: 'https://apt.customserver.net/apt' })
|
86
108
|
end
|
87
109
|
|
88
110
|
it 'overwrites any nil values with pre-defined defaults' do
|
89
111
|
default_win_url = described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:win_download_url]
|
90
|
-
expect(
|
112
|
+
expect(subject.sanitize_opts(opts)).to include({ win_download_url: default_win_url })
|
91
113
|
end
|
92
114
|
|
93
115
|
it 'keeps empty strings' do
|
94
|
-
expect(
|
116
|
+
expect(subject.sanitize_opts(opts)).to include({ dev_builds_url: '' })
|
95
117
|
end
|
96
118
|
|
97
119
|
it 'adds any undefined defaults' do
|
98
120
|
default_mac_url = described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:mac_download_url]
|
99
|
-
expect(
|
121
|
+
expect(subject.sanitize_opts(opts)).to include({ mac_download_url: default_mac_url })
|
100
122
|
end
|
101
123
|
end
|
102
124
|
|
103
|
-
|
104
125
|
context '#configure_foss_defaults_on' do
|
105
126
|
it 'uses aio paths for hosts with role aio' do
|
106
127
|
hosts.each do |host|
|
@@ -112,7 +133,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
112
133
|
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
113
134
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
114
135
|
|
115
|
-
subject.configure_foss_defaults_on(
|
136
|
+
subject.configure_foss_defaults_on(hosts)
|
116
137
|
end
|
117
138
|
|
118
139
|
it 'uses no paths for hosts with no type' do
|
@@ -123,7 +144,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
123
144
|
expect(subject).to receive(:add_foss_defaults_on).never
|
124
145
|
expect(subject).to receive(:add_puppet_paths_on).never
|
125
146
|
|
126
|
-
subject.configure_foss_defaults_on(
|
147
|
+
subject.configure_foss_defaults_on(hosts)
|
127
148
|
end
|
128
149
|
|
129
150
|
it 'uses aio paths for hosts with aio type (backwards compatability)' do
|
@@ -136,7 +157,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
136
157
|
expect(subject).to receive(:add_foss_defaults_on).never
|
137
158
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
138
159
|
|
139
|
-
subject.configure_foss_defaults_on(
|
160
|
+
subject.configure_foss_defaults_on(hosts)
|
140
161
|
end
|
141
162
|
|
142
163
|
it 'uses aio paths for hosts of version >= 4.0' do
|
@@ -149,7 +170,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
149
170
|
expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
|
150
171
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
151
172
|
|
152
|
-
subject.configure_foss_defaults_on(
|
173
|
+
subject.configure_foss_defaults_on(hosts)
|
153
174
|
end
|
154
175
|
|
155
176
|
it 'uses foss paths for hosts of version < 4.0' do
|
@@ -161,7 +182,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
161
182
|
expect(subject).to receive(:add_aio_defaults_on).never
|
162
183
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
163
184
|
|
164
|
-
subject.configure_foss_defaults_on(
|
185
|
+
subject.configure_foss_defaults_on(hosts)
|
165
186
|
end
|
166
187
|
|
167
188
|
it 'uses foss paths for foss-like type foss-package' do
|
@@ -174,9 +195,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
174
195
|
expect(subject).to receive(:add_aio_defaults_on).never
|
175
196
|
expect(subject).to receive(:add_puppet_paths_on).exactly(hosts.length).times
|
176
197
|
|
177
|
-
subject.configure_foss_defaults_on(
|
198
|
+
subject.configure_foss_defaults_on(hosts)
|
178
199
|
end
|
179
|
-
|
180
200
|
end
|
181
201
|
|
182
202
|
context 'lookup_in_env' do
|
@@ -196,8 +216,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
196
216
|
env_var = subject.lookup_in_env('nonesuch')
|
197
217
|
expect(env_var).to be == 'present'
|
198
218
|
env_var = subject.lookup_in_env('reallynone')
|
199
|
-
expect(env_var).to be == nil
|
200
|
-
env_var = subject.lookup_in_env('reallynone',nil,'default')
|
219
|
+
expect(env_var).to be == nil # rubocop:disable Style/NilComparison
|
220
|
+
env_var = subject.lookup_in_env('reallynone', nil, 'default')
|
201
221
|
expect(env_var).to be == 'default'
|
202
222
|
end
|
203
223
|
end
|
@@ -251,17 +271,16 @@ describe ClassMixedWithDSLInstallUtils do
|
|
251
271
|
end
|
252
272
|
|
253
273
|
context 'extract_repo_info_from' do
|
254
|
-
[{ :
|
255
|
-
{ :
|
256
|
-
{ :
|
257
|
-
{ :
|
258
|
-
|
259
|
-
|
260
|
-
uri = "#{ type[:path] }#master"
|
274
|
+
[{ protocol: 'git', path: 'git://github.com/puppetlabs/project.git' },
|
275
|
+
{ protocol: 'ssh', path: 'git@github.com:puppetlabs/project.git' },
|
276
|
+
{ protocol: 'https', path: 'https://github.com:puppetlabs/project' },
|
277
|
+
{ protocol: 'file', path: 'file:///home/example/project' },].each do |type|
|
278
|
+
it "handles #{type[:protocol]} uris" do
|
279
|
+
uri = "#{type[:path]}#master"
|
261
280
|
repo_info = subject.extract_repo_info_from uri
|
262
|
-
expect(
|
263
|
-
expect(
|
264
|
-
expect(
|
281
|
+
expect(repo_info[:name]).to be == 'project'
|
282
|
+
expect(repo_info[:path]).to be == type[:path]
|
283
|
+
expect(repo_info[:rev]).to be == 'master'
|
265
284
|
end
|
266
285
|
end
|
267
286
|
end
|
@@ -269,66 +288,67 @@ describe ClassMixedWithDSLInstallUtils do
|
|
269
288
|
context 'order_packages' do
|
270
289
|
it 'orders facter, hiera before puppet, before anything else' do
|
271
290
|
named_repos = [
|
272
|
-
{ :
|
291
|
+
{ name: 'puppet_plugin' }, { name: 'puppet' }, { name: 'facter' },
|
273
292
|
]
|
274
293
|
ordered_repos = subject.order_packages named_repos
|
275
|
-
expect(
|
276
|
-
expect(
|
277
|
-
expect(
|
294
|
+
expect(ordered_repos[0][:name]).to be == 'facter'
|
295
|
+
expect(ordered_repos[1][:name]).to be == 'puppet'
|
296
|
+
expect(ordered_repos[2][:name]).to be == 'puppet_plugin'
|
278
297
|
end
|
279
298
|
end
|
280
299
|
|
281
300
|
context 'find_git_repo_versions' do
|
282
301
|
it 'returns a hash of :name => version' do
|
283
|
-
host = double(
|
284
|
-
repository = { :
|
302
|
+
host = double('Host')
|
303
|
+
repository = { name: 'name' }
|
285
304
|
path = '/path/to/repo'
|
286
305
|
cmd = 'cd /path/to/repo/name && git describe || true'
|
287
306
|
logger = double.as_null_object
|
288
307
|
|
289
|
-
allow(
|
290
|
-
expect(
|
291
|
-
expect(
|
292
|
-
expect(
|
308
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
309
|
+
expect(subject).to receive(:logger).and_return(logger)
|
310
|
+
expect(subject).to receive(:on).with(host, cmd).and_yield
|
311
|
+
expect(subject).to receive(:stdout).and_return('2')
|
293
312
|
|
294
|
-
subject.instance_variable_set(
|
295
|
-
version = subject.find_git_repo_versions(
|
313
|
+
subject.instance_variable_set(:@metadata, {})
|
314
|
+
version = subject.find_git_repo_versions(host, path, repository)
|
296
315
|
|
297
|
-
expect(
|
316
|
+
expect(version).to be == { 'name' => '2' }
|
298
317
|
end
|
299
318
|
end
|
300
319
|
|
301
320
|
context 'install_puppet_from_rpm_on' do
|
302
321
|
it 'installs puppet release repo when set' do
|
303
|
-
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio,'puppet',
|
322
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio, 'puppet',
|
323
|
+
{ puppet_collection: 'puppet' })
|
304
324
|
|
305
|
-
subject.install_puppet_from_rpm_on(
|
325
|
+
subject.install_puppet_from_rpm_on(el6hostaio, { puppet_collection: 'puppet' })
|
306
326
|
end
|
307
327
|
|
308
328
|
it 'installs PC1 release repo when AIO' do
|
309
|
-
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio,'pc1',{})
|
329
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio, 'pc1', {})
|
310
330
|
|
311
|
-
subject.install_puppet_from_rpm_on(
|
331
|
+
subject.install_puppet_from_rpm_on(el6hostaio, {})
|
312
332
|
end
|
313
333
|
|
314
334
|
it 'installs non-PC1 package when not-AIO' do
|
315
|
-
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostfoss,nil,{})
|
335
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostfoss, nil, {})
|
316
336
|
|
317
|
-
subject.install_puppet_from_rpm_on(
|
337
|
+
subject.install_puppet_from_rpm_on(el6hostfoss, {})
|
318
338
|
end
|
319
339
|
end
|
320
340
|
|
321
341
|
context 'install_puppet_from_freebsd_ports_on' do
|
322
|
-
it 'installs puppet on FreeBSD
|
323
|
-
expect(
|
342
|
+
it 'installs puppet on FreeBSD 12' do
|
343
|
+
expect(freebsdhost12).to receive(:install_package).with('sysutils/puppet7')
|
324
344
|
|
325
|
-
subject.install_puppet_from_freebsd_ports_on(
|
345
|
+
subject.install_puppet_from_freebsd_ports_on(freebsdhost12, {})
|
326
346
|
end
|
327
347
|
|
328
|
-
it 'installs puppet on FreeBSD
|
329
|
-
expect(
|
348
|
+
it 'installs puppet on FreeBSD 13' do
|
349
|
+
expect(freebsdhost13).to receive(:install_package).with('sysutils/puppet7')
|
330
350
|
|
331
|
-
subject.install_puppet_from_freebsd_ports_on(
|
351
|
+
subject.install_puppet_from_freebsd_ports_on(freebsdhost13, {})
|
332
352
|
end
|
333
353
|
end
|
334
354
|
|
@@ -340,206 +360,229 @@ describe ClassMixedWithDSLInstallUtils do
|
|
340
360
|
end
|
341
361
|
|
342
362
|
it 'installs puppet on cygwin windows' do
|
343
|
-
allow(subject).to receive(:link_exists?).and_return(
|
344
|
-
expect(subject).to receive(:on).with(winhost,
|
345
|
-
|
346
|
-
expect(subject).to receive(:
|
363
|
+
allow(subject).to receive(:link_exists?).and_return(true)
|
364
|
+
expect(subject).to receive(:on).with(winhost,
|
365
|
+
"curl --location --output \"#{win_temp}\\puppet-3.7.1-x64.msi\" --remote-name http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
|
366
|
+
expect(subject).to receive(:on).with(winhost,
|
367
|
+
" echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
368
|
+
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, { debug: nil })
|
347
369
|
|
348
|
-
subject.install_puppet_from_msi(
|
370
|
+
subject.install_puppet_from_msi(winhost,
|
371
|
+
{ version: '3.7.1', win_download_url: 'http://downloads.puppet.com/windows' })
|
349
372
|
end
|
350
373
|
|
351
374
|
it 'installs puppet on cygwin windows via proxy' do
|
352
|
-
allow(subject).to receive(:link_exists?).and_return(
|
353
|
-
expect(subject).to receive(:on).with(winhost,
|
354
|
-
|
355
|
-
expect(subject).to receive(:
|
375
|
+
allow(subject).to receive(:link_exists?).and_return(true)
|
376
|
+
expect(subject).to receive(:on).with(winhost,
|
377
|
+
"curl -x https://proxy.com --location --output \"#{win_temp}\\puppet-3.7.1-x64.msi\" --remote-name http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
|
378
|
+
expect(subject).to receive(:on).with(winhost,
|
379
|
+
" echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
380
|
+
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, { debug: nil })
|
356
381
|
|
357
|
-
subject.install_puppet_from_msi(
|
382
|
+
subject.install_puppet_from_msi(winhost,
|
383
|
+
{ version: '3.7.1', win_download_url: 'http://downloads.puppet.com/windows',
|
384
|
+
package_proxy: 'https://proxy.com', })
|
358
385
|
end
|
359
386
|
|
360
387
|
it 'installs puppet on non-cygwin windows' do
|
361
|
-
allow(subject).to receive(:link_exists?).and_return(
|
388
|
+
allow(subject).to receive(:link_exists?).and_return(true)
|
362
389
|
|
363
390
|
expect(winhost_non_cygwin).to receive(:mkdir_p).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
364
391
|
|
365
|
-
expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of(
|
392
|
+
expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of(Beaker::Command)) do |host, beaker_command|
|
366
393
|
expect(beaker_command.command).to eq('powershell.exe')
|
367
|
-
expect(beaker_command.args).to eq([
|
394
|
+
expect(beaker_command.args).to eq(['-ExecutionPolicy Bypass', '-InputFormat None', '-NoLogo', '-NoProfile',
|
395
|
+
'-NonInteractive', "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppet.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')",])
|
368
396
|
end.once
|
369
397
|
|
370
|
-
expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {},
|
398
|
+
expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {},
|
399
|
+
{ debug: nil })
|
371
400
|
|
372
|
-
subject.install_puppet_from_msi(
|
401
|
+
subject.install_puppet_from_msi(winhost_non_cygwin,
|
402
|
+
{ version: '3.7.1', win_download_url: 'http://downloads.puppet.com/windows' })
|
373
403
|
end
|
374
404
|
|
375
405
|
it 'installs puppet on non-cygwin windows via proxy' do
|
376
|
-
allow(subject).to receive(:link_exists?).and_return(
|
406
|
+
allow(subject).to receive(:link_exists?).and_return(true)
|
377
407
|
|
378
408
|
expect(winhost_non_cygwin).to receive(:mkdir_p).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
379
409
|
|
380
|
-
expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of(
|
410
|
+
expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of(Beaker::Command)) do |host, beaker_command|
|
381
411
|
expect(beaker_command.command).to eq('powershell.exe')
|
382
|
-
expect(beaker_command.args).to eq([
|
412
|
+
expect(beaker_command.args).to eq(['-ExecutionPolicy Bypass', '-InputFormat None', '-NoLogo', '-NoProfile',
|
413
|
+
'-NonInteractive', "-Command $webclient = New-Object System.Net.WebClient; $webclient.Proxy = New-Object System.Net.WebProxy('https://proxy.com',$true); $webclient.DownloadFile('http://downloads.puppet.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')",])
|
383
414
|
end.once
|
384
415
|
|
385
|
-
expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {},
|
386
|
-
|
387
|
-
subject.install_puppet_from_msi( winhost_non_cygwin, {:version => '3.7.1', :win_download_url => 'http://downloads.puppet.com/windows', :package_proxy => 'https://proxy.com'})
|
416
|
+
expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {},
|
417
|
+
{ debug: nil })
|
388
418
|
|
419
|
+
subject.install_puppet_from_msi(winhost_non_cygwin,
|
420
|
+
{ version: '3.7.1', win_download_url: 'http://downloads.puppet.com/windows',
|
421
|
+
package_proxy: 'https://proxy.com', })
|
389
422
|
end
|
390
423
|
end
|
391
424
|
|
392
425
|
context 'clone_git_repo_on' do
|
393
426
|
it 'does a ton of stuff it probably shouldnt' do
|
394
|
-
repo = { :
|
395
|
-
:
|
396
|
-
:
|
427
|
+
repo = { name: 'puppet',
|
428
|
+
path: 'git://my.server.net/puppet.git',
|
429
|
+
rev: 'master', }
|
397
430
|
path = '/path/to/repos'
|
398
431
|
host = { 'platform' => 'debian' }
|
399
432
|
logger = double.as_null_object
|
400
433
|
|
401
|
-
allow(
|
402
|
-
allow(
|
434
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
435
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
403
436
|
|
404
|
-
expect(
|
405
|
-
expect(
|
437
|
+
expect(subject).to receive(:logger).exactly(2).times.and_return(logger)
|
438
|
+
expect(subject).to receive(:on).exactly(3).times
|
406
439
|
|
407
|
-
subject.instance_variable_set(
|
408
|
-
subject.clone_git_repo_on(
|
440
|
+
subject.instance_variable_set(:@metadata, {})
|
441
|
+
subject.clone_git_repo_on(host, path, repo)
|
409
442
|
end
|
410
443
|
|
411
444
|
it 'allows a checkout depth of 1' do
|
412
|
-
repo = { :
|
413
|
-
:
|
414
|
-
:
|
415
|
-
:
|
445
|
+
repo = { name: 'puppet',
|
446
|
+
path: 'git://my.server.net/puppet.git',
|
447
|
+
rev: 'master',
|
448
|
+
depth: 1, }
|
416
449
|
|
417
450
|
path = '/path/to/repos'
|
418
451
|
cmd = "test -d #{path}/#{repo[:name]} || git clone --branch #{repo[:rev]} --depth #{repo[:depth]} #{repo[:path]} #{path}/#{repo[:name]}"
|
419
452
|
host = { 'platform' => 'debian' }
|
420
453
|
logger = double.as_null_object
|
421
|
-
allow(
|
422
|
-
allow(
|
423
|
-
expect(
|
424
|
-
expect(
|
454
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
455
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
456
|
+
expect(subject).to receive(:logger).exactly(2).times.and_return(logger)
|
457
|
+
expect(subject).to receive(:on).with(host, "test -d #{path} || mkdir -p #{path}",
|
458
|
+
{ accept_all_exit_codes: true }).exactly(1).times
|
425
459
|
# this is the the command we want to test
|
426
|
-
expect(
|
427
|
-
expect(
|
460
|
+
expect(subject).to receive(:on).with(host, cmd, { accept_all_exit_codes: true }).exactly(1).times
|
461
|
+
expect(subject).to receive(:on).with(host,
|
462
|
+
"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
|
428
463
|
|
429
|
-
subject.instance_variable_set(
|
430
|
-
subject.clone_git_repo_on(
|
464
|
+
subject.instance_variable_set(:@metadata, {})
|
465
|
+
subject.clone_git_repo_on(host, path, repo)
|
431
466
|
end
|
432
467
|
|
433
468
|
it 'allows a checkout depth with a rev from a specific branch' do
|
434
|
-
repo = { :
|
435
|
-
:
|
436
|
-
:
|
437
|
-
:
|
438
|
-
:
|
469
|
+
repo = { name: 'puppet',
|
470
|
+
path: 'git://my.server.net/puppet.git',
|
471
|
+
rev: 'a2340acddadfeafd234230faf',
|
472
|
+
depth: 50,
|
473
|
+
depth_branch: 'master', }
|
439
474
|
|
440
475
|
path = '/path/to/repos'
|
441
476
|
cmd = "test -d #{path}/#{repo[:name]} || git clone --branch #{repo[:depth_branch]} --depth #{repo[:depth]} #{repo[:path]} #{path}/#{repo[:name]}"
|
442
477
|
host = { 'platform' => 'debian' }
|
443
|
-
allow(
|
478
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
444
479
|
logger = double.as_null_object
|
445
|
-
allow(
|
446
|
-
expect(
|
447
|
-
expect(
|
480
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
481
|
+
expect(subject).to receive(:logger).exactly(2).times.and_return(logger)
|
482
|
+
expect(subject).to receive(:on).with(host, "test -d #{path} || mkdir -p #{path}",
|
483
|
+
{ accept_all_exit_codes: true }).exactly(1).times
|
448
484
|
# this is the the command we want to test
|
449
|
-
expect(
|
450
|
-
expect(
|
485
|
+
expect(subject).to receive(:on).with(host, cmd, { accept_all_exit_codes: true }).exactly(1).times
|
486
|
+
expect(subject).to receive(:on).with(host,
|
487
|
+
"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
|
451
488
|
|
452
|
-
subject.instance_variable_set(
|
453
|
-
subject.clone_git_repo_on(
|
489
|
+
subject.instance_variable_set(:@metadata, {})
|
490
|
+
subject.clone_git_repo_on(host, path, repo)
|
454
491
|
end
|
455
492
|
end
|
456
493
|
|
457
494
|
context 'install_from_git' do
|
458
495
|
it 'does a ton of stuff it probably shouldnt' do
|
459
|
-
repo = { :
|
460
|
-
:
|
461
|
-
:
|
496
|
+
repo = { name: 'puppet',
|
497
|
+
path: 'git://my.server.net/puppet.git',
|
498
|
+
rev: 'master', }
|
462
499
|
path = '/path/to/repos'
|
463
500
|
host = { 'platform' => 'debian' }
|
464
501
|
logger = double.as_null_object
|
465
502
|
|
466
|
-
allow(
|
467
|
-
allow(
|
503
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
504
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
468
505
|
|
469
|
-
expect(
|
470
|
-
expect(
|
506
|
+
expect(subject).to receive(:logger).exactly(3).times.and_return(logger)
|
507
|
+
expect(subject).to receive(:on).exactly(4).times
|
471
508
|
|
472
|
-
subject.instance_variable_set(
|
473
|
-
subject.install_from_git(
|
509
|
+
subject.instance_variable_set(:@metadata, {})
|
510
|
+
subject.install_from_git(host, path, repo)
|
474
511
|
end
|
475
512
|
|
476
513
|
it 'should attempt to install ruby code' do
|
477
|
-
repo = { :
|
478
|
-
:
|
479
|
-
:
|
480
|
-
:
|
514
|
+
repo = { name: 'puppet',
|
515
|
+
path: 'git://my.server.net/puppet.git',
|
516
|
+
rev: 'master',
|
517
|
+
depth: 1, }
|
481
518
|
|
482
519
|
path = '/path/to/repos'
|
483
520
|
cmd = "test -d #{path}/#{repo[:name]} || git clone --branch #{repo[:rev]} --depth #{repo[:depth]} #{repo[:path]} #{path}/#{repo[:name]}"
|
484
521
|
host = { 'platform' => 'debian' }
|
485
522
|
logger = double.as_null_object
|
486
|
-
allow(
|
487
|
-
allow(
|
488
|
-
expect(
|
489
|
-
expect(
|
490
|
-
|
491
|
-
expect(
|
492
|
-
expect(
|
493
|
-
|
494
|
-
subject.
|
495
|
-
|
523
|
+
allow(subject).to receive(:metadata).and_return(metadata)
|
524
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
525
|
+
expect(subject).to receive(:logger).exactly(3).times.and_return(logger)
|
526
|
+
expect(subject).to receive(:on).with(host, "test -d #{path} || mkdir -p #{path}",
|
527
|
+
{ accept_all_exit_codes: true }).exactly(1).times
|
528
|
+
expect(subject).to receive(:on).with(host, cmd, { accept_all_exit_codes: true }).exactly(1).times
|
529
|
+
expect(subject).to receive(:on).with(host,
|
530
|
+
"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
|
531
|
+
expect(subject).to receive(:on).with(host,
|
532
|
+
"cd #{path}/#{repo[:name]} && if [ -f install.rb ]; then ruby ./install.rb ; else true; fi", { accept_all_exit_codes: true }).exactly(1).times
|
533
|
+
|
534
|
+
subject.instance_variable_set(:@metadata, {})
|
535
|
+
subject.install_from_git_on(host, path, repo)
|
496
536
|
end
|
497
|
-
|
537
|
+
end
|
498
538
|
|
499
539
|
describe '#install_puppet' do
|
500
540
|
let(:hosts) do
|
501
|
-
make_hosts({:
|
541
|
+
make_hosts({ platform: platform })
|
502
542
|
end
|
503
543
|
|
504
544
|
before do
|
505
|
-
allow(
|
506
|
-
allow(
|
507
|
-
allow(
|
545
|
+
allow(subject).to receive(:options).and_return(opts)
|
546
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
547
|
+
allow(subject).to receive(:on).and_return(Beaker::Result.new({}, ''))
|
508
548
|
end
|
509
549
|
context 'on el-6' do
|
510
550
|
let(:platform) { Beaker::Platform.new('el-6-i386') }
|
511
551
|
it 'installs' do
|
512
|
-
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/,
|
552
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/,
|
553
|
+
'--replacepkgs', { package_proxy: false })
|
513
554
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
514
555
|
subject.install_puppet
|
515
556
|
end
|
516
557
|
it 'installs in parallel' do
|
517
558
|
InParallel::InParallelExecutor.logger = logger
|
518
559
|
FakeFS.deactivate!
|
519
|
-
hosts.each
|
520
|
-
allow(host).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/, '--replacepkgs',
|
560
|
+
hosts.each do |host|
|
561
|
+
allow(host).to receive(:install_package_with_rpm).with(/puppet-release-el-6\.noarch\.rpm/, '--replacepkgs',
|
562
|
+
{ package_proxy: false })
|
521
563
|
allow(host).to receive(:install_package).with('puppet')
|
522
|
-
|
564
|
+
end
|
523
565
|
opts[:run_in_parallel] = true
|
524
566
|
# This will only get hit if forking processes is supported and at least 2 items are being submitted to run in parallel
|
525
|
-
expect(
|
567
|
+
expect(InParallel::InParallelExecutor).to receive(:_execute_in_parallel).with(any_args).and_call_original.exactly(3).times
|
526
568
|
subject.install_puppet(opts)
|
527
569
|
end
|
528
570
|
it 'installs specific version of puppet when passed :version' do
|
529
571
|
expect(hosts[0]).to receive(:install_package).with('puppet-3')
|
530
|
-
subject.install_puppet(
|
572
|
+
subject.install_puppet(version: '3')
|
531
573
|
end
|
532
574
|
it 'can install specific versions of puppets dependencies' do
|
533
575
|
expect(hosts[0]).to receive(:install_package).with('puppet-3')
|
534
576
|
expect(hosts[0]).to receive(:install_package).with('hiera-2001')
|
535
577
|
expect(hosts[0]).to receive(:install_package).with('facter-1999')
|
536
|
-
subject.install_puppet(
|
578
|
+
subject.install_puppet(version: '3', facter_version: '1999', hiera_version: '2001')
|
537
579
|
end
|
538
580
|
end
|
539
581
|
context 'on el-5' do
|
540
582
|
let(:platform) { Beaker::Platform.new('el-5-i386') }
|
541
583
|
it 'installs' do
|
542
|
-
expect(hosts[0]).to receive(:install_package_with_rpm).with(
|
584
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppet-release-el-5.noarch.rpm/, '--replacepkgs',
|
585
|
+
{ package_proxy: false })
|
543
586
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
544
587
|
subject.install_puppet
|
545
588
|
end
|
@@ -547,7 +590,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
547
590
|
context 'on fedora' do
|
548
591
|
let(:platform) { Beaker::Platform.new('fedora-18-x86_84') }
|
549
592
|
it 'installs' do
|
550
|
-
expect(hosts[0]).to receive(:install_package_with_rpm).with(
|
593
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppet-release-fedora-18.noarch.rpm/,
|
594
|
+
'--replacepkgs', { package_proxy: false })
|
551
595
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
552
596
|
subject.install_puppet
|
553
597
|
end
|
@@ -559,6 +603,13 @@ describe ClassMixedWithDSLInstallUtils do
|
|
559
603
|
subject.install_puppet
|
560
604
|
end
|
561
605
|
end
|
606
|
+
context 'on freebsd' do
|
607
|
+
let(:platform) { Beaker::Platform.new('freebsd-13-amd64') }
|
608
|
+
it 'installs' do
|
609
|
+
expect(hosts[0]).to receive(:install_package).with('sysutils/puppet7')
|
610
|
+
subject.install_puppet
|
611
|
+
end
|
612
|
+
end
|
562
613
|
context 'on debian' do
|
563
614
|
PlatformHelpers::DEBIANPLATFORMS.each do |platform|
|
564
615
|
let(:platform) { Beaker::Platform.new("#{platform}-ver-arch") }
|
@@ -573,14 +624,14 @@ describe ClassMixedWithDSLInstallUtils do
|
|
573
624
|
it 'installs specific version of puppet when passed :version' do
|
574
625
|
expect(hosts[0]).to receive(:install_package).with('puppet=3-1puppetlabs1')
|
575
626
|
expect(hosts[0]).to receive(:install_package).with('puppet-common=3-1puppetlabs1')
|
576
|
-
subject.install_puppet(
|
627
|
+
subject.install_puppet(version: '3')
|
577
628
|
end
|
578
629
|
it 'can install specific versions of puppets dependencies' do
|
579
630
|
expect(hosts[0]).to receive(:install_package).with('facter=1999-1puppetlabs1')
|
580
631
|
expect(hosts[0]).to receive(:install_package).with('hiera=2001-1puppetlabs1')
|
581
632
|
expect(hosts[0]).to receive(:install_package).with('puppet-common=3-1puppetlabs1')
|
582
633
|
expect(hosts[0]).to receive(:install_package).with('puppet=3-1puppetlabs1')
|
583
|
-
subject.install_puppet(
|
634
|
+
subject.install_puppet(version: '3', facter_version: '1999', hiera_version: '2001')
|
584
635
|
end
|
585
636
|
end
|
586
637
|
context 'on windows' do
|
@@ -589,37 +640,40 @@ describe ClassMixedWithDSLInstallUtils do
|
|
589
640
|
before :each do
|
590
641
|
allow(winhost).to receive(:tmpdir).and_return(win_temp)
|
591
642
|
allow(winhost).to receive(:is_cygwin?).and_return(true)
|
592
|
-
allow(subject).to receive(:link_exists?).and_return(
|
643
|
+
allow(subject).to receive(:link_exists?).and_return(true)
|
593
644
|
allow(subject).to receive(:install_msi_on).with(any_args)
|
594
645
|
end
|
595
646
|
|
596
647
|
it 'installs specific version of puppet when passed :version' do
|
597
648
|
hosts.each do |host|
|
598
|
-
if host
|
599
|
-
allow(subject).to receive(:on).with(host, anything)
|
600
|
-
else
|
649
|
+
if host == winhost
|
601
650
|
expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.msi\" -O http://downloads.puppet.com/windows/puppet-3.msi")
|
602
|
-
expect(subject).to receive(:on).with(winhost,
|
603
|
-
|
651
|
+
expect(subject).to receive(:on).with(winhost,
|
652
|
+
" echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
|
653
|
+
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.msi", {},
|
654
|
+
{ debug: nil }).exactly(1).times
|
655
|
+
else
|
656
|
+
allow(subject).to receive(:on).with(host, anything)
|
604
657
|
end
|
605
658
|
end
|
606
|
-
subject.install_puppet(:
|
659
|
+
subject.install_puppet(version: '3')
|
607
660
|
end
|
608
661
|
it 'installs from custom url when passed :win_download_url' do
|
609
662
|
hosts.each do |host|
|
610
|
-
if host
|
611
|
-
allow(subject).to receive(:on).with(host, anything)
|
612
|
-
else
|
663
|
+
if host == winhost
|
613
664
|
expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.msi\" -O http://nightlies.puppet.com/puppet-latest/repos/windows/puppet-3.msi")
|
614
|
-
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.msi", {}, {:
|
665
|
+
expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.msi", {}, { debug: nil })
|
666
|
+
else
|
667
|
+
allow(subject).to receive(:on).with(host, anything)
|
615
668
|
end
|
616
669
|
end
|
617
|
-
subject.install_puppet(
|
670
|
+
subject.install_puppet(version: '3',
|
671
|
+
win_download_url: 'http://nightlies.puppet.com/puppet-latest/repos/windows')
|
618
672
|
end
|
619
673
|
end
|
620
674
|
describe 'on unsupported platforms' do
|
621
675
|
let(:platform) { Beaker::Platform.new('solaris-11-x86_64') }
|
622
|
-
let(:host) { make_host('henry', :
|
676
|
+
let(:host) { make_host('henry', platform: 'solaris-11-x86_64') }
|
623
677
|
let(:hosts) { [host] }
|
624
678
|
it 'by default raises an error' do
|
625
679
|
expect(subject).to_not receive(:on)
|
@@ -628,10 +682,10 @@ describe ClassMixedWithDSLInstallUtils do
|
|
628
682
|
it 'falls back to installing from gem when given :default_action => "gem_install"' do
|
629
683
|
result = double
|
630
684
|
gem_env_string = '{"RubyGems Environment": [ {"GEM PATHS": [], "EXECUTABLE DIRECTORY": "/does/not/exist" } ] }'
|
631
|
-
allow(
|
685
|
+
allow(result).to receive(:stdout).and_return gem_env_string
|
632
686
|
allow(subject).to receive(:on).with(host, /gem environment/).and_return result
|
633
687
|
expect(subject).to receive(:on).with(host, /gem install/)
|
634
|
-
subject.install_puppet :
|
688
|
+
subject.install_puppet default_action: 'gem_install'
|
635
689
|
end
|
636
690
|
end
|
637
691
|
end
|
@@ -640,13 +694,13 @@ describe ClassMixedWithDSLInstallUtils do
|
|
640
694
|
context 'on debian' do
|
641
695
|
PlatformHelpers::DEBIANPLATFORMS.each do |platform|
|
642
696
|
let(:platform) { Beaker::Platform.new("#{platform}-ver-arch") }
|
643
|
-
let(:host) { make_host('testbox.test.local', :
|
697
|
+
let(:host) { make_host('testbox.test.local', platform: "#{platform}") }
|
644
698
|
it "it sets the puppet.conf file to the provided config on #{platform}" do
|
645
|
-
config = { 'main' => {'server' => 'testbox.test.local'} }
|
699
|
+
config = { 'main' => { 'server' => 'testbox.test.local' } }
|
646
700
|
expected_config_string = "[main]\nserver=testbox.test.local\n\n"
|
647
701
|
|
648
|
-
expect(
|
649
|
-
|
702
|
+
expect(subject).to receive(:create_remote_file).with(
|
703
|
+
host, anything, expected_config_string
|
650
704
|
)
|
651
705
|
subject.configure_puppet_on(host, config)
|
652
706
|
end
|
@@ -654,13 +708,13 @@ describe ClassMixedWithDSLInstallUtils do
|
|
654
708
|
end
|
655
709
|
context 'on windows' do
|
656
710
|
let(:platform) { 'windows-2008R2-amd64' }
|
657
|
-
let(:host) { make_host('testbox.test.local', :
|
711
|
+
let(:host) { make_host('testbox.test.local', platform: 'windows-2008R2-amd64') }
|
658
712
|
|
659
713
|
it 'it sets the puppet.conf file to the provided config' do
|
660
|
-
config = { 'main' => {'server' => 'testbox.test.local'} }
|
714
|
+
config = { 'main' => { 'server' => 'testbox.test.local' } }
|
661
715
|
expected_config_string = "[main]\nserver=testbox.test.local\n\n"
|
662
716
|
|
663
|
-
expect(
|
717
|
+
expect(subject).to receive(:create_remote_file).with(
|
664
718
|
host, anything, expected_config_string
|
665
719
|
)
|
666
720
|
subject.configure_puppet_on(host, config)
|
@@ -670,22 +724,22 @@ describe ClassMixedWithDSLInstallUtils do
|
|
670
724
|
|
671
725
|
describe 'configure_puppet' do
|
672
726
|
let(:hosts) do
|
673
|
-
make_hosts({:
|
727
|
+
make_hosts({ platform: platform })
|
674
728
|
end
|
675
729
|
|
676
730
|
before do
|
677
|
-
allow(
|
678
|
-
allow(
|
731
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
732
|
+
allow(subject).to receive(:on).and_return(Beaker::Result.new({}, ''))
|
679
733
|
end
|
680
734
|
|
681
735
|
context 'on debian' do
|
682
736
|
PlatformHelpers::DEBIANPLATFORMS.each do |platform|
|
683
737
|
let(:platform) { Beaker::Platform.new("#{platform}-ver-arch") }
|
684
738
|
it "calls configure_puppet_on correctly on #{platform}" do
|
685
|
-
config = { 'main' => {'server' => 'testbox.test.local'} }
|
686
|
-
expect(
|
687
|
-
|
688
|
-
).exactly(
|
739
|
+
config = { 'main' => { 'server' => 'testbox.test.local' } }
|
740
|
+
expect(subject).to receive(:configure_puppet_on).with(
|
741
|
+
anything, config
|
742
|
+
).exactly(hosts.length).times
|
689
743
|
subject.configure_puppet(config)
|
690
744
|
end
|
691
745
|
end
|
@@ -695,157 +749,154 @@ describe ClassMixedWithDSLInstallUtils do
|
|
695
749
|
let(:platform) { 'windows-2008R2-amd64' }
|
696
750
|
|
697
751
|
it 'calls configure_puppet_on correctly' do
|
698
|
-
config = { 'main' => {'server' => 'testbox.test.local'} }
|
699
|
-
expect(
|
752
|
+
config = { 'main' => { 'server' => 'testbox.test.local' } }
|
753
|
+
expect(subject).to receive(:configure_puppet_on).with(
|
700
754
|
anything, config
|
701
|
-
).exactly(
|
755
|
+
).exactly(hosts.length).times
|
702
756
|
subject.configure_puppet(config)
|
703
757
|
end
|
704
758
|
end
|
705
759
|
end
|
706
760
|
|
707
|
-
describe
|
708
|
-
let(
|
709
|
-
let(
|
761
|
+
describe '#install_puppetlabs_release_repo' do
|
762
|
+
let(:platform) { Beaker::Platform.new('solaris-7-i386') }
|
763
|
+
let(:host) do
|
710
764
|
FakeHost.create('fakevm', platform.to_s)
|
711
765
|
end
|
712
766
|
|
713
767
|
before do
|
714
768
|
allow(subject).to receive(:options) { opts }
|
715
|
-
allow(
|
769
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
716
770
|
end
|
717
771
|
|
718
|
-
describe
|
719
|
-
let(
|
772
|
+
describe 'When host is unsupported platform' do
|
773
|
+
let(:platform) { Beaker::Platform.new('solaris-7-i386') }
|
720
774
|
|
721
|
-
it
|
722
|
-
expect
|
775
|
+
it 'raises an exception.' do
|
776
|
+
expect do
|
723
777
|
subject.install_puppetlabs_release_repo host
|
724
|
-
|
778
|
+
end.to raise_error(RuntimeError, /No repository installation step for/)
|
725
779
|
end
|
726
780
|
end
|
727
781
|
|
728
|
-
describe
|
729
|
-
let(
|
782
|
+
describe 'When host is a debian-like platform' do
|
783
|
+
let(:platform) { Beaker::Platform.new('debian-7-i386') }
|
730
784
|
|
731
|
-
it
|
732
|
-
expect(subject).to receive(:on).with(
|
733
|
-
expect(subject).to receive(:on).with(
|
734
|
-
expect(subject).to receive(:on).with(
|
785
|
+
it 'downloads a deb file, installs, and updates the apt cache.' do
|
786
|
+
expect(subject).to receive(:on).with(host, /wget .*/).ordered
|
787
|
+
expect(subject).to receive(:on).with(host, /dpkg .*/).ordered
|
788
|
+
expect(subject).to receive(:on).with(host, 'apt-get update').ordered
|
735
789
|
subject.install_puppetlabs_release_repo host
|
736
790
|
end
|
737
|
-
|
738
791
|
end
|
739
|
-
|
740
792
|
end
|
741
793
|
|
742
794
|
describe '#install_puppetlabs_release_repo_on' do
|
743
|
-
let(
|
744
|
-
FakeHost.create(
|
795
|
+
let(:host) do
|
796
|
+
FakeHost.create('fakevm', platform.to_s)
|
745
797
|
end
|
746
798
|
|
747
799
|
before :each do
|
748
|
-
allow(
|
800
|
+
allow(subject).to receive(:options) { opts }
|
749
801
|
end
|
750
802
|
|
751
803
|
context 'on el 7' do
|
752
|
-
let(
|
804
|
+
let(:platform) { Beaker::Platform.new('el-7-x86_64') }
|
753
805
|
it 'returns the correct url when repo is set to puppet8' do
|
754
|
-
expect(
|
755
|
-
|
806
|
+
expect(host).to receive(:install_package_with_rpm).with(/puppet8-release-el-7\.noarch\.rpm$/,
|
807
|
+
'--replacepkgs', { package_proxy: false })
|
808
|
+
subject.install_puppetlabs_release_repo_on(host, 'puppet8')
|
756
809
|
end
|
757
810
|
it 'returns the correct url when opts[:puppet_collection] is set to puppet14' do
|
758
|
-
expect(
|
759
|
-
|
811
|
+
expect(host).to receive(:install_package_with_rpm).with(/puppet14-release-el-7\.noarch\.rpm$/,
|
812
|
+
'--replacepkgs', { package_proxy: false })
|
813
|
+
subject.install_puppetlabs_release_repo_on(host, nil, { puppet_collection: 'puppet14' })
|
760
814
|
end
|
761
815
|
it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
|
762
|
-
expect(
|
763
|
-
|
816
|
+
expect(host).to receive(:install_package_with_rpm).with(/puppet-release-el-7\.noarch\.rpm$/,
|
817
|
+
'--replacepkgs', { package_proxy: false })
|
818
|
+
subject.install_puppetlabs_release_repo_on(host)
|
764
819
|
end
|
765
820
|
end
|
766
821
|
|
767
822
|
context 'on debian 8' do
|
768
|
-
let(
|
823
|
+
let(:platform) { Beaker::Platform.new('debian-8-i386') }
|
769
824
|
it 'returns the correct url when repo is set to puppet4' do
|
770
|
-
expect(
|
771
|
-
expect(
|
772
|
-
expect(
|
773
|
-
subject.install_puppetlabs_release_repo_on(
|
825
|
+
expect(subject).to receive(:on).with(host, /puppet4-release-jessie\.deb$/).once
|
826
|
+
expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
|
827
|
+
expect(subject).to receive(:on).with(host, 'apt-get update').once
|
828
|
+
subject.install_puppetlabs_release_repo_on(host, 'puppet4')
|
774
829
|
end
|
775
830
|
it 'returns the correct url when opts[:puppet_collection] is set to puppet7' do
|
776
|
-
expect(
|
777
|
-
expect(
|
778
|
-
expect(
|
779
|
-
subject.install_puppetlabs_release_repo_on(
|
831
|
+
expect(subject).to receive(:on).with(host, /puppet7-release-jessie\.deb$/).once
|
832
|
+
expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
|
833
|
+
expect(subject).to receive(:on).with(host, 'apt-get update').once
|
834
|
+
subject.install_puppetlabs_release_repo_on(host, nil, { puppet_collection: 'puppet7' })
|
780
835
|
end
|
781
836
|
it 'returns the correct url when both repo and opts[:puppet_collection] are nil' do
|
782
|
-
expect(
|
783
|
-
expect(
|
784
|
-
expect(
|
785
|
-
subject.install_puppetlabs_release_repo_on(
|
837
|
+
expect(subject).to receive(:on).with(host, /puppet-release-jessie\.deb$/).once
|
838
|
+
expect(subject).to receive(:on).with(host, 'dpkg -i --force-all /tmp/puppet.deb').once
|
839
|
+
expect(subject).to receive(:on).with(host, 'apt-get update').once
|
840
|
+
subject.install_puppetlabs_release_repo_on(host)
|
786
841
|
end
|
787
842
|
end
|
788
843
|
|
789
|
-
|
790
844
|
context 'on cisco platforms' do
|
791
845
|
context 'version 5' do
|
792
|
-
let(
|
846
|
+
let(:platform) { Beaker::Platform.new('cisco_nexus-7-x86_64') }
|
793
847
|
|
794
848
|
it 'calls host.install_package' do
|
795
|
-
expect(
|
796
|
-
subject.install_puppetlabs_release_repo_on(
|
849
|
+
expect(host).to receive(:install_package).with(/\.rpm$/)
|
850
|
+
subject.install_puppetlabs_release_repo_on(host)
|
797
851
|
end
|
798
852
|
end
|
799
853
|
|
800
854
|
context 'version 7' do
|
801
|
-
let(
|
855
|
+
let(:platform) { Beaker::Platform.new('cisco_ios_xr-6-x86_64') }
|
802
856
|
|
803
857
|
it 'uses yum localinstall to install the package' do
|
804
|
-
expect(
|
805
|
-
subject.install_puppetlabs_release_repo_on(
|
858
|
+
expect(subject).to receive(:on).with(host, /^yum.*localinstall.*\.rpm$/)
|
859
|
+
subject.install_puppetlabs_release_repo_on(host)
|
806
860
|
end
|
807
861
|
end
|
808
862
|
end
|
809
|
-
|
810
863
|
end
|
811
864
|
|
812
|
-
describe
|
813
|
-
let(
|
814
|
-
let(
|
815
|
-
let(
|
865
|
+
describe '#install_puppetlabs_dev_repo' do
|
866
|
+
let(:package_name) { 'puppet' }
|
867
|
+
let(:package_version) { '7.5.6' }
|
868
|
+
let(:host) do
|
816
869
|
h = FakeHost.create('fakvm', platform.to_s, opts)
|
817
|
-
allow(
|
870
|
+
allow(h).to receive(:link_exists?).and_return(true)
|
818
871
|
h
|
819
872
|
end
|
820
|
-
let(
|
873
|
+
let(:logger_double) do
|
821
874
|
logger_double = Object.new
|
822
875
|
allow(logger_double).to receive(:debug)
|
823
876
|
allow(logger_double).to receive(:trace)
|
824
|
-
allow(
|
877
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
825
878
|
subject.instance_variable_set(:@logger, logger_double)
|
826
879
|
logger_double
|
827
880
|
end
|
828
881
|
|
829
|
-
RSpec.shared_examples
|
830
|
-
|
882
|
+
RSpec.shared_examples 'install-dev-repo' do
|
831
883
|
it "scp's files to SUT then modifies them with find-and-sed 2-hit combo" do
|
832
884
|
allow(rez).to receive(:exit_code) { 0 }
|
833
885
|
allow(subject).to receive(:link_exists?).and_return(true)
|
834
|
-
expect(subject).to receive(:scp_to).with(
|
886
|
+
expect(subject).to receive(:scp_to).with(host, repo_config, /.*/).ordered
|
835
887
|
subject.install_puppetlabs_dev_repo host, package_name, package_version
|
836
888
|
end
|
837
|
-
|
838
889
|
end
|
839
890
|
|
840
|
-
describe
|
841
|
-
let(
|
891
|
+
describe 'When host is unsupported platform' do
|
892
|
+
let(:platform) { Beaker::Platform.new('solaris-7-i386') }
|
842
893
|
|
843
|
-
it
|
894
|
+
it 'raises an exception.' do
|
844
895
|
# expect(subject).to receive(:on).with( host, /^mkdir -p .*$/ ).ordered
|
845
896
|
allow(subject).to receive(:options) { opts }
|
846
|
-
expect
|
897
|
+
expect do
|
847
898
|
subject.install_puppetlabs_dev_repo host, package_name, package_version
|
848
|
-
|
899
|
+
end.to raise_error(RuntimeError, /No repository installation step for/)
|
849
900
|
end
|
850
901
|
end
|
851
902
|
|
@@ -854,161 +905,154 @@ describe ClassMixedWithDSLInstallUtils do
|
|
854
905
|
# are expectations in the share examples, but aren't interesting
|
855
906
|
# beyond those basic tests
|
856
907
|
def stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
|
857
|
-
allow(subject).to receive(:scp_to).with(
|
908
|
+
allow(subject).to receive(:scp_to).with(host, repo_config, /.*/).ordered
|
858
909
|
end
|
859
910
|
|
860
|
-
let(
|
861
|
-
let(
|
862
|
-
let(
|
911
|
+
let(:repo_config) { 'repoconfig' }
|
912
|
+
let(:repo_dir) { 'repodir' }
|
913
|
+
let(:rez) { double }
|
863
914
|
|
864
915
|
before do
|
865
916
|
allow(subject).to receive(:fetch_http_file) { repo_config }
|
866
917
|
allow(subject).to receive(:fetch_http_dir) { repo_dir }
|
867
|
-
allow(subject).to receive(:on).with(host,
|
918
|
+
allow(subject).to receive(:on).with(host, 'apt-get update') {}
|
868
919
|
allow(subject).to receive(:options) { opts }
|
869
|
-
allow(subject).to receive(:on).with(
|
920
|
+
allow(subject).to receive(:on).with(host, /^.* -d .*/, { acceptable_exit_codes: [0, 1] }).and_return(rez)
|
870
921
|
end
|
871
922
|
|
872
|
-
describe
|
923
|
+
describe 'that are debian-like' do
|
873
924
|
PlatformHelpers::DEBIANPLATFORMS.each do |platform|
|
874
925
|
let(:platform) { Beaker::Platform.new("#{platform}-ver-arch") }
|
875
926
|
before { allow(subject).to receive(:link_exists?).and_return(true) }
|
876
927
|
|
877
|
-
include_examples
|
878
|
-
|
928
|
+
include_examples 'install-dev-repo'
|
879
929
|
end
|
880
930
|
end
|
881
931
|
|
882
|
-
describe
|
883
|
-
let(
|
884
|
-
include_examples
|
932
|
+
describe 'that are redhat-like' do
|
933
|
+
let(:platform) { Beaker::Platform.new('el-7-i386') }
|
934
|
+
include_examples 'install-dev-repo'
|
885
935
|
end
|
886
936
|
end
|
887
937
|
end
|
888
938
|
|
889
939
|
describe '#install_packages_from_local_dev_repo' do
|
890
|
-
let(
|
891
|
-
let(
|
892
|
-
let(
|
940
|
+
let(:package_name) { 'puppet-agent' }
|
941
|
+
let(:platform) { @platform || 'other' }
|
942
|
+
let(:host) do
|
893
943
|
FakeHost.create('fakvm', platform, opts)
|
894
944
|
end
|
895
945
|
|
896
946
|
before :each do
|
897
|
-
allow(
|
947
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
898
948
|
end
|
899
949
|
|
900
950
|
it 'sets the find command correctly for el-based systems' do
|
901
951
|
@platform = 'el-1-3'
|
902
|
-
expect(
|
903
|
-
subject.install_packages_from_local_dev_repo(
|
952
|
+
expect(subject).to receive(:on).with(host, /\*\.rpm.+rpm\s-ivh/)
|
953
|
+
subject.install_packages_from_local_dev_repo(host, package_name)
|
904
954
|
end
|
905
955
|
|
906
956
|
it 'sets the find command correctly for debian-based systems' do
|
907
957
|
@platform = 'debian-1-3'
|
908
|
-
expect(
|
909
|
-
subject.install_packages_from_local_dev_repo(
|
958
|
+
expect(subject).to receive(:on).with(host, /\*\.deb.+dpkg\s-i/)
|
959
|
+
subject.install_packages_from_local_dev_repo(host, package_name)
|
910
960
|
end
|
911
961
|
|
912
962
|
it 'fails correctly for systems not accounted for' do
|
913
963
|
@platform = 'eos-1-3'
|
914
|
-
expect{ subject.install_packages_from_local_dev_repo(
|
964
|
+
expect { subject.install_packages_from_local_dev_repo(host, package_name) }.to raise_error RuntimeError
|
915
965
|
end
|
916
|
-
|
917
966
|
end
|
918
967
|
|
919
968
|
describe '#msi_link_path' do
|
920
|
-
let(
|
921
|
-
let(
|
922
|
-
let(
|
969
|
+
let(:opts) { { puppet_agent_version: 'VERSION', win_download_url: 'http://downloads.puppet.com/windows' } }
|
970
|
+
let(:platform) { 'windows' }
|
971
|
+
let(:host) { { :platform => platform, 'dist' => 'puppet-agent-VERSION-x64' } }
|
923
972
|
|
924
973
|
it 'returns the right link when puppet collection is set' do
|
925
|
-
allow(subject).to receive(:link_exists?).with(anything
|
974
|
+
allow(subject).to receive(:link_exists?).with(anything).and_return(true)
|
926
975
|
|
927
|
-
expect(subject.msi_link_path(
|
976
|
+
expect(subject.msi_link_path(host,
|
977
|
+
opts.merge({ puppet_collection: 'puppet' }))).to eq "#{opts[:win_download_url]}/puppet/puppet-agent-VERSION-x64.msi"
|
928
978
|
end
|
929
979
|
|
930
980
|
it 'returns the right link when puppet collection is not set' do
|
931
|
-
expect(subject).to receive(:link_exists?).with(anything
|
981
|
+
expect(subject).to receive(:link_exists?).with(anything).and_return(true)
|
932
982
|
|
933
|
-
expect(subject.msi_link_path(
|
983
|
+
expect(subject.msi_link_path(host, opts)).to eq "#{opts[:win_download_url]}/puppet-agent-VERSION-x64.msi"
|
934
984
|
end
|
935
985
|
|
936
986
|
it 'returns error when link incorrect' do
|
937
|
-
allow(subject).to receive(:link_exists?).with(anything
|
987
|
+
allow(subject).to receive(:link_exists?).with(anything).and_return(false)
|
938
988
|
|
939
|
-
expect
|
940
|
-
subject.msi_link_path(
|
941
|
-
|
989
|
+
expect do
|
990
|
+
subject.msi_link_path(host, opts)
|
991
|
+
end.to raise_error(RuntimeError,
|
992
|
+
%r{Puppet MSI at http://downloads.puppet.com/windows/puppet-agent-VERSION-x64.msi does not exist!})
|
942
993
|
end
|
943
994
|
end
|
944
995
|
|
945
996
|
describe '#install_puppet_agent_from_msi_on' do
|
946
|
-
let(
|
947
|
-
let(
|
948
|
-
let(
|
997
|
+
let(:opts) { { puppet_agent_version: 'VERSION', win_download_url: 'http://downloads.puppet.com/windows' } }
|
998
|
+
let(:platform) { 'windows' }
|
999
|
+
let(:host) { { platform: platform } }
|
949
1000
|
|
950
1001
|
it 'uses x86 msi when host is_x86_64 and install_32 is set on the host' do
|
951
1002
|
host['install_32'] = true
|
952
1003
|
|
953
|
-
expect(
|
954
|
-
expect(
|
955
|
-
|
956
|
-
subject.install_puppet_agent_from_msi_on( host, opts )
|
957
|
-
expect( host['dist'] ).to be == "puppet-agent-VERSION-x86"
|
1004
|
+
expect(host).to receive(:is_x86_64?).and_return(true)
|
1005
|
+
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
958
1006
|
|
1007
|
+
subject.install_puppet_agent_from_msi_on(host, opts)
|
1008
|
+
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
|
959
1009
|
end
|
960
1010
|
|
961
1011
|
it 'uses x86 msi when host is_x86_64 and install_32 is set on the options' do
|
962
1012
|
opts['install_32'] = true
|
963
1013
|
|
964
|
-
expect(
|
965
|
-
expect(
|
966
|
-
|
967
|
-
subject.install_puppet_agent_from_msi_on( host, opts )
|
968
|
-
expect( host['dist'] ).to be == "puppet-agent-VERSION-x86"
|
1014
|
+
expect(host).to receive(:is_x86_64?).and_return(true)
|
1015
|
+
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
969
1016
|
|
1017
|
+
subject.install_puppet_agent_from_msi_on(host, opts)
|
1018
|
+
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
|
970
1019
|
end
|
971
1020
|
|
972
1021
|
it 'uses x86 msi when host is_x86_64 and ruby_arch is x86 on the host' do
|
973
1022
|
host['ruby_arch'] = 'x86'
|
974
1023
|
|
975
|
-
expect(
|
976
|
-
expect(
|
977
|
-
|
978
|
-
subject.install_puppet_agent_from_msi_on( host, opts )
|
979
|
-
expect( host['dist'] ).to be == "puppet-agent-VERSION-x86"
|
1024
|
+
expect(host).to receive(:is_x86_64?).and_return(true)
|
1025
|
+
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
980
1026
|
|
1027
|
+
subject.install_puppet_agent_from_msi_on(host, opts)
|
1028
|
+
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
|
981
1029
|
end
|
982
1030
|
|
983
1031
|
it 'uses x86 msi when host !is_x86_64' do
|
1032
|
+
expect(host).to receive(:is_x86_64?).and_return(false)
|
1033
|
+
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
984
1034
|
|
985
|
-
|
986
|
-
expect(
|
987
|
-
|
988
|
-
subject.install_puppet_agent_from_msi_on( host, opts )
|
989
|
-
expect( host['dist'] ).to be == "puppet-agent-VERSION-x86"
|
990
|
-
|
1035
|
+
subject.install_puppet_agent_from_msi_on(host, opts)
|
1036
|
+
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
|
991
1037
|
end
|
992
1038
|
|
993
1039
|
it 'uses x64 msi when host is_x86_64, no install_32 and ruby_arch != x86' do
|
1040
|
+
expect(host).to receive(:is_x86_64?).and_return(true)
|
1041
|
+
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
994
1042
|
|
995
|
-
|
996
|
-
expect(
|
997
|
-
|
998
|
-
subject.install_puppet_agent_from_msi_on( host, opts )
|
999
|
-
expect( host['dist'] ).to be == "puppet-agent-VERSION-x64"
|
1000
|
-
|
1043
|
+
subject.install_puppet_agent_from_msi_on(host, opts)
|
1044
|
+
expect(host['dist']).to be == 'puppet-agent-VERSION-x64'
|
1001
1045
|
end
|
1002
1046
|
end
|
1003
1047
|
|
1004
1048
|
describe '#install_cert_on_windows' do
|
1005
1049
|
before do
|
1006
|
-
allow(subject).to receive(:on).and_return(Beaker::Result.new({},''))
|
1050
|
+
allow(subject).to receive(:on).and_return(Beaker::Result.new({}, ''))
|
1007
1051
|
end
|
1008
1052
|
|
1009
1053
|
context 'on windows' do
|
1010
1054
|
let(:platform) { 'windows-2008R2-amd64' }
|
1011
|
-
let(:host) { make_host('testbox.test.local', :
|
1055
|
+
let(:host) { make_host('testbox.test.local', platform: 'windows-2008R2-amd64') }
|
1012
1056
|
|
1013
1057
|
it 'should install all 3 certs' do
|
1014
1058
|
cert = 'geotrust_global_ca'
|
@@ -1049,228 +1093,222 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1049
1093
|
end
|
1050
1094
|
|
1051
1095
|
describe '#install_puppet_agent_dev_repo_on' do
|
1052
|
-
let(
|
1053
|
-
let(
|
1054
|
-
let(
|
1055
|
-
FakeHost.create(
|
1096
|
+
let(:package_name) { 'puppet-agent' }
|
1097
|
+
let(:platform) { @platform || 'other' }
|
1098
|
+
let(:host) do
|
1099
|
+
FakeHost.create('fakvm', platform, opts)
|
1056
1100
|
end
|
1057
1101
|
|
1058
1102
|
before :each do
|
1059
|
-
allow(
|
1103
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
1060
1104
|
end
|
1061
1105
|
|
1062
1106
|
it 'raises an exception when host platform is unsupported' do
|
1063
|
-
platform = Object.new()
|
1064
|
-
allow(platform).to receive(:to_array) { ['ptan', '5', 'x4']}
|
1065
1107
|
host = basic_hosts.first
|
1066
|
-
host['platform'] =
|
1067
|
-
opts = { :
|
1068
|
-
allow(
|
1108
|
+
host['platform'] = Beaker::Platform.new('f5-5-x4')
|
1109
|
+
opts = { version: '0.1.0' }
|
1110
|
+
allow(subject).to receive(:options).and_return({})
|
1069
1111
|
|
1070
|
-
expect
|
1071
|
-
subject.install_puppet_agent_dev_repo_on(
|
1072
|
-
|
1112
|
+
expect do
|
1113
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1114
|
+
end.to raise_error(RuntimeError, /No repository installation step for/)
|
1073
1115
|
end
|
1074
1116
|
|
1075
1117
|
it 'runs the correct install for el-based platforms' do
|
1076
|
-
platform = Object.new()
|
1077
|
-
allow(platform).to receive(:to_array) { ['el', '5', 'x4']}
|
1078
1118
|
host = basic_hosts.first
|
1079
|
-
host['platform'] =
|
1119
|
+
host['platform'] = Beaker::Platform.new('el-5-x86_64')
|
1080
1120
|
sha_value = 'ereiuwoiur'
|
1081
|
-
opts = { :
|
1082
|
-
allow(
|
1121
|
+
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1122
|
+
allow(subject).to receive(:options).and_return({})
|
1083
1123
|
|
1084
|
-
expect(
|
1085
|
-
host, 'puppet-agent', sha_value, nil, anything
|
1086
|
-
|
1124
|
+
expect(subject).to receive(:install_puppetlabs_dev_repo).with(
|
1125
|
+
host, 'puppet-agent', sha_value, nil, anything
|
1126
|
+
)
|
1127
|
+
expect(host).to receive(:install_package).with('puppet-agent')
|
1087
1128
|
|
1088
|
-
subject.install_puppet_agent_dev_repo_on(
|
1129
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1089
1130
|
end
|
1090
1131
|
|
1091
1132
|
it 'runs the correct install for el-based platforms on s390x architectures' do
|
1092
|
-
platform = Object.new()
|
1093
|
-
allow(platform).to receive(:to_array) { ['el', '5', 's390x'] }
|
1094
1133
|
host = basic_hosts.first
|
1095
|
-
host['platform'] =
|
1134
|
+
host['platform'] = Beaker::Platform.new('el-5-s390x')
|
1096
1135
|
sha_value = 'ereiuwoiur'
|
1097
|
-
opts = { :
|
1098
|
-
allow(
|
1136
|
+
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1137
|
+
allow(subject).to receive(:options).and_return({})
|
1099
1138
|
|
1100
1139
|
release_path_end = 'fake_release_path_end'
|
1101
1140
|
release_file = 'fake_29835_release_file'
|
1102
|
-
expect(
|
1103
|
-
[
|
1141
|
+
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1142
|
+
[release_path_end, release_file],
|
1143
|
+
)
|
1104
1144
|
|
1105
1145
|
expect(subject).not_to receive(:install_puppetlabs_dev_repo)
|
1106
1146
|
expect(host).not_to receive(:install_package)
|
1107
1147
|
|
1108
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file,
|
1148
|
+
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/el$})
|
1109
1149
|
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, anything)
|
1110
1150
|
expect(subject).to receive(:on).ordered.with(host, /rpm -ivh.*#{release_file}$/)
|
1111
1151
|
|
1112
|
-
subject.install_puppet_agent_dev_repo_on(
|
1152
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1113
1153
|
end
|
1114
1154
|
|
1115
1155
|
it 'runs the correct agent install for el-based platforms on ec2 hypervisor' do
|
1116
|
-
platform = Object.new()
|
1117
|
-
allow(platform).to receive(:to_array) { ['el', '5', 'x4'] }
|
1118
1156
|
host = basic_hosts.first
|
1119
|
-
host['platform'] =
|
1157
|
+
host['platform'] = Beaker::Platform.new('el-5-x86_64')
|
1120
1158
|
host['hypervisor'] = 'ec2'
|
1121
1159
|
sha_value = 'ereiuwoiur'
|
1122
|
-
opts = { :
|
1123
|
-
allow(
|
1160
|
+
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1161
|
+
allow(subject).to receive(:options).and_return({})
|
1124
1162
|
|
1125
1163
|
release_path_end = 'fake_release_path_end'
|
1126
1164
|
release_file = 'fake_29835_release_file'
|
1127
|
-
expect(
|
1128
|
-
[
|
1165
|
+
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1166
|
+
[release_path_end, release_file],
|
1167
|
+
)
|
1129
1168
|
|
1130
1169
|
expect(subject).not_to receive(:install_puppetlabs_dev_repo)
|
1131
1170
|
expect(host).not_to receive(:install_package)
|
1132
1171
|
|
1133
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file,
|
1172
|
+
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/el$})
|
1134
1173
|
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, anything)
|
1135
1174
|
expect(subject).to receive(:on).ordered.with(host, /rpm -ivh.*#{release_file}$/)
|
1136
1175
|
|
1137
|
-
subject.install_puppet_agent_dev_repo_on(
|
1176
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1138
1177
|
end
|
1139
1178
|
|
1140
1179
|
it 'runs the correct install for debian-based platforms' do
|
1141
|
-
platform =
|
1142
|
-
allow(platform).to receive(:to_array) { ['debian', '5', 'x4']}
|
1180
|
+
platform = Beaker::Platform.new('debian-5-x86_64')
|
1143
1181
|
host = basic_hosts.first
|
1144
1182
|
host['platform'] = platform
|
1145
1183
|
sha_value = 'ereigregerge'
|
1146
|
-
opts = { :
|
1147
|
-
allow(
|
1184
|
+
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1185
|
+
allow(subject).to receive(:options).and_return({})
|
1148
1186
|
|
1149
|
-
expect(
|
1150
|
-
host, 'puppet-agent', sha_value, nil, anything
|
1151
|
-
|
1187
|
+
expect(subject).to receive(:install_puppetlabs_dev_repo).with(
|
1188
|
+
host, 'puppet-agent', sha_value, nil, anything
|
1189
|
+
)
|
1190
|
+
expect(host).to receive(:install_package).with('puppet-agent')
|
1152
1191
|
|
1153
|
-
subject.install_puppet_agent_dev_repo_on(
|
1192
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1154
1193
|
end
|
1155
1194
|
|
1156
1195
|
it 'runs the correct install for windows platforms' do
|
1157
1196
|
host = winhost
|
1158
1197
|
external_copy_base = 'tmp_install_windows_copy_base_1325'
|
1159
|
-
allow(
|
1160
|
-
opts = { :
|
1161
|
-
allow(
|
1198
|
+
allow(host).to receive(:external_copy_base).and_return(external_copy_base)
|
1199
|
+
opts = { version: '0.1.0' }
|
1200
|
+
allow(subject).to receive(:options).and_return({})
|
1162
1201
|
copied_path = "#{win_temp}\\puppet-agent-0.1.0-x64.msi"
|
1163
|
-
mock_echo = Object.new
|
1164
|
-
allow(
|
1202
|
+
mock_echo = Object.new
|
1203
|
+
allow(mock_echo).to receive(:raw_output).and_return(copied_path)
|
1165
1204
|
|
1166
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1167
|
-
expect(subject).to receive(:scp_to).once.with(host,
|
1168
|
-
expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, {:
|
1205
|
+
expect(subject).to receive(:fetch_http_file).once.with(%r{/windows$}, 'puppet-agent-0.1.0-x64.msi', %r{/windows$})
|
1206
|
+
expect(subject).to receive(:scp_to).once.with(host, %r{/puppet-agent-0.1.0-x64.msi$}, /#{external_copy_base}/)
|
1207
|
+
expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, { debug: nil }).once
|
1169
1208
|
expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
|
1170
1209
|
|
1171
|
-
subject.install_puppet_agent_dev_repo_on(
|
1210
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1172
1211
|
end
|
1173
1212
|
|
1174
1213
|
it 'runs the correct install for osx platforms' do
|
1175
|
-
platform = Object.new()
|
1176
|
-
allow(platform).to receive(:to_array) { ['osx', '10.9', 'x86_64', 'mavericks']}
|
1177
1214
|
host = machost
|
1178
|
-
host['platform'] =
|
1215
|
+
host['platform'] = Beaker::Platform.new('osx-109-x86_64')
|
1179
1216
|
sha_value = 'runs the correct install for osx platforms'
|
1180
1217
|
copy_dir_external = 'fake_15_copy_dir_external'
|
1181
1218
|
opts = {
|
1182
|
-
:
|
1183
|
-
:
|
1184
|
-
:
|
1219
|
+
version: '0.1.0',
|
1220
|
+
puppet_agent_sha: sha_value,
|
1221
|
+
copy_dir_external: copy_dir_external,
|
1185
1222
|
}
|
1186
1223
|
|
1187
1224
|
release_path_end = 'fake_release_path_end'
|
1188
1225
|
release_file = 'fake_29835_release_file'
|
1189
|
-
expect(
|
1190
|
-
[
|
1226
|
+
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1227
|
+
[release_path_end, release_file],
|
1228
|
+
)
|
1191
1229
|
|
1192
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file,
|
1230
|
+
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/osx$})
|
1193
1231
|
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, copy_dir_external)
|
1194
1232
|
# the star is necessary, as that's not the entire filename, & we rely on
|
1195
1233
|
# the globbing to get this right on OSX SUTs
|
1196
|
-
expect(host).to receive(
|
1234
|
+
expect(host).to receive(:install_package).with(/^puppet-agent-0.1.0\*$/)
|
1197
1235
|
|
1198
|
-
subject.install_puppet_agent_dev_repo_on(
|
1236
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1199
1237
|
end
|
1200
1238
|
|
1201
1239
|
it 'runs the correct install for solaris platforms' do
|
1202
1240
|
@platform = 'solaris-10-x86_64'
|
1203
|
-
opts = { :
|
1204
|
-
allow(
|
1241
|
+
opts = { version: '0.1.0' }
|
1242
|
+
allow(subject).to receive(:options).and_return({})
|
1205
1243
|
|
1206
1244
|
release_path_end = 'fake_release_path_end'
|
1207
1245
|
release_file = 'fake_sol10_8495_release_file'
|
1208
|
-
expect(
|
1209
|
-
[
|
1246
|
+
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1247
|
+
[release_path_end, release_file],
|
1248
|
+
)
|
1210
1249
|
|
1211
|
-
expect(
|
1212
|
-
/#{release_path_end}$/, release_file, anything
|
1213
|
-
|
1214
|
-
|
1250
|
+
expect(subject).to receive(:fetch_http_file).once.with(
|
1251
|
+
/#{release_path_end}$/, release_file, anything
|
1252
|
+
)
|
1253
|
+
expect(subject).to receive(:scp_to).once.with(
|
1254
|
+
host, /#{release_file}$/, anything
|
1255
|
+
)
|
1215
1256
|
|
1216
|
-
expect(
|
1257
|
+
expect(host).to receive(:solaris_install_local_package)
|
1217
1258
|
|
1218
|
-
allow(
|
1219
|
-
subject.install_puppet_agent_dev_repo_on(
|
1259
|
+
allow(subject).to receive(:configure_type_defaults_on)
|
1260
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1220
1261
|
end
|
1221
1262
|
|
1222
1263
|
it 'allows you to override the local copy directory' do
|
1223
1264
|
# only applies to hosts that don't go down the
|
1224
1265
|
# install_puppetlabs_dev_repo route
|
1225
|
-
platform = Object.new()
|
1226
|
-
allow( platform ).to receive( :to_array ) { ['eos', '5', 'x4'] }
|
1227
1266
|
host = eoshost
|
1228
|
-
host['platform'] =
|
1267
|
+
host['platform'] = Beaker::Platform.new('eos-5-x86_64')
|
1229
1268
|
sha_value = 'dahdahdahdah'
|
1230
1269
|
copy_base_local_override = 'face'
|
1231
1270
|
opts = {
|
1232
|
-
:
|
1233
|
-
:
|
1234
|
-
:
|
1271
|
+
version: '0.1.0',
|
1272
|
+
copy_base_local: copy_base_local_override,
|
1273
|
+
puppet_agent_sha: sha_value,
|
1235
1274
|
}
|
1236
|
-
allow(
|
1275
|
+
allow(subject).to receive(:options).and_return({})
|
1237
1276
|
|
1238
|
-
allow(
|
1277
|
+
allow(host).to receive(:puppet_agent_dev_package_info).and_return(['', ''])
|
1239
1278
|
|
1240
|
-
allow(
|
1241
|
-
allow(
|
1279
|
+
allow(host).to receive(:get_remote_file).once.with(anything)
|
1280
|
+
allow(host).to receive(:install_from_file)
|
1242
1281
|
|
1243
|
-
subject.install_puppet_agent_dev_repo_on(
|
1282
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1244
1283
|
end
|
1245
1284
|
|
1246
1285
|
it 'allows you to override the external copy directory' do
|
1247
|
-
platform = Object.new()
|
1248
|
-
allow(platform).to receive(:to_array) { ['osx', '5', 'x4']}
|
1249
1286
|
host = basic_hosts.first
|
1250
|
-
host['platform'] =
|
1287
|
+
host['platform'] = Beaker::Platform.new('osx-5-x86_64')
|
1251
1288
|
copy_dir_custom = 'muppetsBB8-1435'
|
1252
|
-
opts = { :
|
1253
|
-
allow(
|
1289
|
+
opts = { version: '0.1.0', copy_dir_external: copy_dir_custom }
|
1290
|
+
allow(subject).to receive(:options).and_return({})
|
1254
1291
|
|
1255
|
-
allow(
|
1292
|
+
allow(host).to receive(:puppet_agent_dev_package_info).and_return(['', ''])
|
1256
1293
|
|
1257
|
-
allow(
|
1258
|
-
expect(
|
1259
|
-
host, anything, /#{copy_dir_custom}/
|
1260
|
-
|
1294
|
+
allow(subject).to receive(:fetch_http_file).once
|
1295
|
+
expect(subject).to receive(:scp_to).once.with(
|
1296
|
+
host, anything, /#{copy_dir_custom}/
|
1297
|
+
)
|
1298
|
+
allow(host).to receive(:install_package)
|
1261
1299
|
|
1262
|
-
subject.install_puppet_agent_dev_repo_on(
|
1300
|
+
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1263
1301
|
end
|
1264
1302
|
|
1265
1303
|
it 'copies package to the cygwin root directory and installs it' do
|
1266
1304
|
@platform = 'windows-7-x86_64'
|
1267
|
-
expect(
|
1305
|
+
expect(subject).to receive(:install_msi_on).with(any_args)
|
1268
1306
|
copy_base = 'copy_base_cygwin'
|
1269
|
-
allow(
|
1270
|
-
expect(
|
1271
|
-
expect(
|
1272
|
-
expect(
|
1273
|
-
subject.install_puppet_agent_dev_repo_on(
|
1307
|
+
allow(host).to receive(:external_copy_base).and_return(copy_base)
|
1308
|
+
expect(subject).to receive(:scp_to).with(host, /puppet-agent-1\.0\.0-x64\.msi/, /#{copy_base}/)
|
1309
|
+
expect(subject).to receive(:configure_type_defaults_on).with(host)
|
1310
|
+
expect(subject).to receive(:fetch_http_file).with(%r{[^/]\z}, anything, anything)
|
1311
|
+
subject.install_puppet_agent_dev_repo_on(host, opts.merge({ puppet_agent_version: '1.0.0' }))
|
1274
1312
|
end
|
1275
1313
|
|
1276
1314
|
it 'installs on different hosts without erroring' do
|
@@ -1278,40 +1316,38 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1278
1316
|
mhosts[3] = eoshost
|
1279
1317
|
|
1280
1318
|
mhosts.each_with_index do |host, index|
|
1281
|
-
platform = Object.new()
|
1282
1319
|
if index == 0
|
1283
|
-
|
1284
|
-
allow(host).to receive(:external_copy_base) {'/host0'}
|
1320
|
+
host['platform'] = Beaker::Platform.new('solaris-5-x4')
|
1321
|
+
allow(host).to receive(:external_copy_base) { '/host0' }
|
1285
1322
|
elsif index == 1
|
1286
|
-
|
1287
|
-
allow(host).to receive(:external_copy_base) {'/host1'}
|
1323
|
+
host['platform'] = Beaker::Platform.new('windows-5-x4')
|
1324
|
+
allow(host).to receive(:external_copy_base) { '/host1' }
|
1288
1325
|
elsif index == 2
|
1289
|
-
|
1290
|
-
allow(host).to receive(:external_copy_base) {'/host2'}
|
1326
|
+
host['platform'] = Beaker::Platform.new('osx-5-x4')
|
1327
|
+
allow(host).to receive(:external_copy_base) { '/host2' }
|
1291
1328
|
elsif index == 3
|
1292
|
-
|
1293
|
-
allow(host).to receive(:external_copy_base) {'/host3'}
|
1329
|
+
host['platform'] = Beaker::Platform.new('eos-5-x4')
|
1330
|
+
allow(host).to receive(:external_copy_base) { '/host3' }
|
1294
1331
|
end
|
1295
|
-
host[
|
1296
|
-
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(["test", "blah"])
|
1332
|
+
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(%w[test blah])
|
1297
1333
|
end
|
1298
1334
|
|
1299
|
-
expect(
|
1335
|
+
expect(subject).to receive(:add_role).with(any_args).exactly(mhosts.length).times
|
1300
1336
|
|
1301
|
-
expect(
|
1302
|
-
expect(
|
1337
|
+
expect(subject).to receive(:fetch_http_file).with(any_args).exactly(3).times
|
1338
|
+
expect(subject).to receive(:scp_to).with(any_args).exactly(3).times
|
1303
1339
|
|
1304
|
-
expect(
|
1305
|
-
expect(
|
1306
|
-
expect(
|
1307
|
-
expect(
|
1340
|
+
expect(subject).to receive(:install_msi_on).with(mhosts[1], 'xyz', {}, anything).exactly(1).times
|
1341
|
+
expect(mhosts[0]).to receive(:solaris_install_local_package).with('blah', '/host0').exactly(1).times
|
1342
|
+
expect(mhosts[2]).to receive(:install_package).with(any_args).exactly(1).times
|
1343
|
+
expect(mhosts[3]).to receive(:install_from_file).with('blah').exactly(1).times
|
1308
1344
|
|
1309
|
-
result = object_double(Beaker::Result.new({},
|
1345
|
+
result = object_double(Beaker::Result.new({}, 'foo'), raw_output: 'xyz')
|
1310
1346
|
allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
|
1311
1347
|
|
1312
|
-
expect(
|
1348
|
+
expect(subject).to receive(:configure_type_defaults_on).with(any_args).exactly(mhosts.length).times
|
1313
1349
|
|
1314
|
-
subject.install_puppet_agent_dev_repo_on(
|
1350
|
+
subject.install_puppet_agent_dev_repo_on(mhosts, opts.merge({ puppet_agent_version: '1.0.0' }))
|
1315
1351
|
end
|
1316
1352
|
|
1317
1353
|
it 'installs on different hosts with options specifying :copy_dir_external' do
|
@@ -1319,171 +1355,168 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1319
1355
|
mhosts[3] = eoshost
|
1320
1356
|
|
1321
1357
|
mhosts.each_with_index do |host, index|
|
1322
|
-
platform = Object.new()
|
1323
1358
|
if index == 0
|
1324
|
-
|
1325
|
-
allow(host).to receive(:external_copy_base) {'/host0'}
|
1359
|
+
host['platform'] = Beaker::Platform.new('solaris-5-x4')
|
1360
|
+
allow(host).to receive(:external_copy_base) { '/host0' }
|
1326
1361
|
elsif index == 1
|
1327
|
-
|
1328
|
-
allow(host).to receive(:external_copy_base) {'/host1'}
|
1362
|
+
host['platform'] = Beaker::Platform.new('windows-5-x4')
|
1363
|
+
allow(host).to receive(:external_copy_base) { '/host1' }
|
1329
1364
|
elsif index == 2
|
1330
|
-
|
1331
|
-
allow(host).to receive(:external_copy_base) {'/host2'}
|
1365
|
+
host['platform'] = Beaker::Platform.new('osx-5-x4')
|
1366
|
+
allow(host).to receive(:external_copy_base) { '/host2' }
|
1332
1367
|
elsif index == 3
|
1333
|
-
|
1334
|
-
allow(host).to receive(:external_copy_base) {'/host3'}
|
1368
|
+
host['platform'] = Beaker::Platform.new('eos-5-x4')
|
1369
|
+
allow(host).to receive(:external_copy_base) { '/host3' }
|
1335
1370
|
end
|
1336
|
-
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return([
|
1337
|
-
host['platform'] = platform
|
1371
|
+
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(['test', '/blah'])
|
1338
1372
|
end
|
1339
1373
|
|
1340
|
-
expect(
|
1374
|
+
expect(subject).to receive(:add_role).with(any_args).exactly(mhosts.length).times
|
1341
1375
|
|
1342
|
-
expect(
|
1343
|
-
expect(
|
1376
|
+
expect(subject).to receive(:fetch_http_file).with(any_args).exactly(3).times
|
1377
|
+
expect(subject).to receive(:scp_to).with(any_args).exactly(3).times
|
1344
1378
|
|
1345
|
-
expect(
|
1346
|
-
expect(
|
1347
|
-
expect(
|
1348
|
-
expect(
|
1349
|
-
expect(
|
1350
|
-
expect(
|
1351
|
-
expect(
|
1352
|
-
expect(
|
1379
|
+
expect(subject).to receive(:install_msi_on).with(mhosts[1], 'xyz', {}, anything).exactly(1).times
|
1380
|
+
expect(mhosts[0]).to receive(:solaris_install_local_package).with('/blah', '/tmp').exactly(1).times
|
1381
|
+
expect(mhosts[2]).to receive(:install_package).with(any_args).exactly(1).times
|
1382
|
+
expect(mhosts[3]).to receive(:install_from_file).with('/blah').exactly(1).times
|
1383
|
+
expect(mhosts[0]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1384
|
+
expect(mhosts[1]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1385
|
+
expect(mhosts[2]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1386
|
+
expect(mhosts[3]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1353
1387
|
|
1354
|
-
result = object_double(Beaker::Result.new({},
|
1388
|
+
result = object_double(Beaker::Result.new({}, 'foo'), raw_output: 'xyz')
|
1355
1389
|
allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
|
1356
1390
|
|
1357
|
-
expect(
|
1391
|
+
expect(subject).to receive(:configure_type_defaults_on).with(any_args).exactly(mhosts.length).times
|
1358
1392
|
|
1359
|
-
subject.install_puppet_agent_dev_repo_on(
|
1393
|
+
subject.install_puppet_agent_dev_repo_on(mhosts,
|
1394
|
+
opts.merge({ puppet_agent_version: '1.0.0', copy_dir_external: '/tmp' }))
|
1360
1395
|
end
|
1361
1396
|
end
|
1362
1397
|
|
1363
1398
|
describe '#install_puppet_agent_pe_promoted_repo_on' do
|
1364
|
-
let(
|
1365
|
-
let(
|
1366
|
-
let(
|
1367
|
-
FakeHost.create(
|
1399
|
+
let(:package_name) { 'puppet-agent' }
|
1400
|
+
let(:platform) { @platform || 'other' }
|
1401
|
+
let(:host) do
|
1402
|
+
FakeHost.create('fakvm', platform, opts)
|
1368
1403
|
end
|
1369
1404
|
|
1370
1405
|
before :each do
|
1371
|
-
allow(
|
1372
|
-
allow(
|
1406
|
+
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
1407
|
+
allow(subject).to receive(:install_msi_on).with(any_args)
|
1373
1408
|
end
|
1374
1409
|
|
1375
1410
|
def test_fetch_http_file_no_ending_slash(platform)
|
1376
1411
|
@platform = platform
|
1377
|
-
allow(
|
1378
|
-
allow(
|
1412
|
+
allow(subject).to receive(:scp_to)
|
1413
|
+
allow(subject).to receive(:configure_type_defaults_on).with(host)
|
1379
1414
|
|
1380
|
-
expect(
|
1381
|
-
subject.install_puppet_agent_pe_promoted_repo_on(
|
1415
|
+
expect(subject).to receive(:fetch_http_file).with(%r{[^/]\z}, anything, anything)
|
1416
|
+
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1382
1417
|
end
|
1383
1418
|
|
1384
1419
|
context 'on windows' do
|
1385
|
-
|
1386
1420
|
it 'calls fetch_http_file with no ending slash' do
|
1387
|
-
test_fetch_http_file_no_ending_slash(
|
1421
|
+
test_fetch_http_file_no_ending_slash('windows-7-x86_64')
|
1388
1422
|
end
|
1389
1423
|
end
|
1390
1424
|
|
1391
1425
|
it 'calls fetch_http_file with no ending slash' do
|
1392
|
-
test_fetch_http_file_no_ending_slash(
|
1426
|
+
test_fetch_http_file_no_ending_slash('debian-5-x86_64')
|
1393
1427
|
end
|
1394
1428
|
|
1395
1429
|
context 'when setting different agent versions' do
|
1396
|
-
let(
|
1397
|
-
let(
|
1398
|
-
let(
|
1430
|
+
let(:host) { basic_hosts.first }
|
1431
|
+
let(:platform) { Beaker::Platform.new('el-6-x86_64') }
|
1432
|
+
let(:downloadurl) { 'http://pm.puppet.com' }
|
1399
1433
|
before :each do
|
1400
|
-
allow(
|
1401
|
-
allow(
|
1402
|
-
allow(
|
1403
|
-
allow( subject ).to receive( :configure_type_defaults_on ).with( host )
|
1434
|
+
allow(subject).to receive(:options).and_return(opts)
|
1435
|
+
allow(subject).to receive(:scp_to)
|
1436
|
+
allow(subject).to receive(:configure_type_defaults_on).with(host)
|
1404
1437
|
end
|
1405
1438
|
|
1406
1439
|
it 'sets correct file paths when agent version is set to latest' do
|
1407
1440
|
host['platform'] = platform
|
1408
1441
|
agentversion = 'latest'
|
1409
1442
|
collection = 'puppet'
|
1410
|
-
opts = { :
|
1443
|
+
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1411
1444
|
|
1412
1445
|
expect(subject).to receive(:fetch_http_file).once.with(
|
1413
|
-
|
1446
|
+
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1414
1447
|
/puppet-agent-el-6*/,
|
1415
|
-
|
1448
|
+
%r{/el$},
|
1416
1449
|
)
|
1417
1450
|
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1418
1451
|
anything,
|
1419
1452
|
/puppet-agent-el-6*/,
|
1420
|
-
|
1453
|
+
%r{.*/el/6/#{collection}/.*rpm},
|
1421
1454
|
/puppet-agent-el-6/,
|
1422
|
-
anything
|
1455
|
+
anything,
|
1423
1456
|
)
|
1424
|
-
subject.install_puppet_agent_pe_promoted_repo_on(
|
1457
|
+
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1425
1458
|
end
|
1426
1459
|
|
1427
1460
|
it 'sets correct file paths for agent version 1.x.x' do
|
1428
1461
|
host['platform'] = platform
|
1429
1462
|
agentversion = '1.x.x'
|
1430
1463
|
collection = 'pc1'
|
1431
|
-
opts = { :
|
1464
|
+
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1432
1465
|
|
1433
1466
|
expect(subject).to receive(:fetch_http_file).once.with(
|
1434
|
-
|
1435
|
-
/puppet-agent-el-6
|
1467
|
+
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1468
|
+
/puppet-agent-el-6*/, %r{/el$}
|
1436
1469
|
)
|
1437
1470
|
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1438
1471
|
anything,
|
1439
1472
|
/puppet-agent-el-6*/,
|
1440
|
-
|
1473
|
+
%r{.*/el/6/#{collection}/.*rpm},
|
1441
1474
|
/puppet-agent-el-6/,
|
1442
|
-
anything
|
1475
|
+
anything,
|
1443
1476
|
)
|
1444
|
-
subject.install_puppet_agent_pe_promoted_repo_on(
|
1477
|
+
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1445
1478
|
end
|
1446
1479
|
|
1447
1480
|
it 'sets correct file paths for agent version >= 5.5.4' do
|
1448
1481
|
host['platform'] = platform
|
1449
1482
|
agentversion = '5.5.4'
|
1450
1483
|
collection = 'puppet5'
|
1451
|
-
opts = { :
|
1484
|
+
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1452
1485
|
|
1453
1486
|
expect(subject).to receive(:fetch_http_file).once.with(
|
1454
|
-
|
1487
|
+
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1455
1488
|
/puppet-agent-el-6*/,
|
1456
|
-
|
1489
|
+
%r{/el$},
|
1457
1490
|
)
|
1458
1491
|
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1459
1492
|
anything,
|
1460
1493
|
/puppet-agent-el-6*/,
|
1461
|
-
|
1494
|
+
%r{.*/el/6/#{collection}/.*rpm},
|
1462
1495
|
/puppet-agent-el-6/,
|
1463
|
-
anything
|
1496
|
+
anything,
|
1464
1497
|
)
|
1465
|
-
subject.install_puppet_agent_pe_promoted_repo_on(
|
1498
|
+
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1466
1499
|
end
|
1467
1500
|
|
1468
1501
|
it 'sets correct file paths for agent version > 5.99' do
|
1469
1502
|
host['platform'] = platform
|
1470
1503
|
agentversion = '6.0.0'
|
1471
1504
|
collection = 'puppet6'
|
1472
|
-
opts = { :
|
1505
|
+
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1473
1506
|
|
1474
1507
|
expect(subject).to receive(:fetch_http_file).once.with(
|
1475
|
-
|
1508
|
+
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1476
1509
|
/puppet-agent-el-6*/,
|
1477
|
-
|
1510
|
+
%r{/el$},
|
1478
1511
|
)
|
1479
1512
|
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1480
1513
|
anything,
|
1481
1514
|
/puppet-agent-el-6*/,
|
1482
|
-
|
1515
|
+
%r{.*/el/6/#{collection}/.*rpm},
|
1483
1516
|
/puppet-agent-el-6/,
|
1484
|
-
anything
|
1517
|
+
anything,
|
1485
1518
|
)
|
1486
|
-
subject.install_puppet_agent_pe_promoted_repo_on(
|
1519
|
+
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1487
1520
|
end
|
1488
1521
|
end
|
1489
1522
|
end
|
@@ -1493,7 +1526,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1493
1526
|
|
1494
1527
|
context 'with default arguments' do
|
1495
1528
|
it "installs the latest puppetserver from the default 'puppet' release stream" do
|
1496
|
-
expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet',
|
1529
|
+
expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet',
|
1530
|
+
include(release_yum_repo_url: 'https://yum.puppet.com'))
|
1497
1531
|
expect(subject).to receive(:install_package).with(host, 'puppetserver', nil)
|
1498
1532
|
subject.install_puppetserver_on(host)
|
1499
1533
|
end
|
@@ -1503,7 +1537,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1503
1537
|
version = '6.6.6'
|
1504
1538
|
|
1505
1539
|
context 'on deb-based platform' do
|
1506
|
-
let(:host) {make_host('master', platform: Beaker::Platform.new('ubuntu-16.04-amd64'))}
|
1540
|
+
let(:host) { make_host('master', platform: Beaker::Platform.new('ubuntu-16.04-amd64')) }
|
1507
1541
|
it 'munges the version on ubuntu 16.04' do
|
1508
1542
|
expect(subject).to receive(:install_puppetlabs_release_repo_on).with(host, 'puppet', anything)
|
1509
1543
|
expect(subject).to receive(:install_package).with(host, 'puppetserver', "#{version}-1xenial")
|
@@ -1513,14 +1547,16 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1513
1547
|
end
|
1514
1548
|
|
1515
1549
|
it 'installs puppetserver at the specific version from internal buildservers' do
|
1516
|
-
expect(subject).to receive(:install_from_build_data_url).with('puppetserver',
|
1550
|
+
expect(subject).to receive(:install_from_build_data_url).with('puppetserver',
|
1551
|
+
/^#{described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:dev_builds_url]}.*#{version}/, host)
|
1517
1552
|
allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return true
|
1518
1553
|
subject.install_puppetserver_on(host, version: version)
|
1519
1554
|
end
|
1520
1555
|
|
1521
1556
|
it 'installs puppetserver from the custom dev builds URL' do
|
1522
1557
|
dev_builds_url = 'http://builds.corp.tld'
|
1523
|
-
expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{dev_builds_url}.*#{version}/,
|
1558
|
+
expect(subject).to receive(:install_from_build_data_url).with('puppetserver', /^#{dev_builds_url}.*#{version}/,
|
1559
|
+
host)
|
1524
1560
|
allow(subject).to receive(:dev_builds_accessible_on?).with(host, anything).and_return true
|
1525
1561
|
subject.install_puppetserver_on(host, version: version, dev_builds_url: dev_builds_url)
|
1526
1562
|
end
|
@@ -1554,9 +1590,10 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1554
1590
|
context 'with the nightlies option' do
|
1555
1591
|
it 'installs puppetserver from the default puppet nightly repos' do
|
1556
1592
|
expect(subject).to receive(:install_puppetlabs_release_repo_on)
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1593
|
+
.with(host, 'puppet-nightly', include(
|
1594
|
+
nightly_yum_repo_url: described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_yum_repo_url],
|
1595
|
+
nightly_apt_repo_url: described_class::FOSS_DEFAULT_DOWNLOAD_URLS[:nightly_apt_repo_url],
|
1596
|
+
))
|
1560
1597
|
subject.install_puppetserver_on(host, nightlies: true)
|
1561
1598
|
end
|
1562
1599
|
|
@@ -1565,23 +1602,26 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1565
1602
|
|
1566
1603
|
it 'uses a custom general nightlies url' do
|
1567
1604
|
expect(subject).to receive(:install_puppetlabs_release_repo_on)
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1605
|
+
.with(host, 'puppet-nightly', include(
|
1606
|
+
nightly_yum_repo_url: custom_nightlies_url,
|
1607
|
+
nightly_apt_repo_url: custom_nightlies_url,
|
1608
|
+
))
|
1571
1609
|
subject.install_puppetserver_on(host, nightlies: true, nightly_builds_url: custom_nightlies_url)
|
1572
1610
|
end
|
1573
1611
|
|
1574
1612
|
it 'uses a custom yum repo url' do
|
1575
1613
|
expect(subject).to receive(:install_puppetlabs_release_repo_on)
|
1576
|
-
|
1577
|
-
|
1614
|
+
.with(host, 'puppet-nightly', include(
|
1615
|
+
nightly_yum_repo_url: custom_nightlies_url,
|
1616
|
+
))
|
1578
1617
|
subject.install_puppetserver_on(host, nightlies: true, nightly_yum_repo_url: custom_nightlies_url)
|
1579
1618
|
end
|
1580
1619
|
|
1581
1620
|
it 'uses a custom apt repo url' do
|
1582
1621
|
expect(subject).to receive(:install_puppetlabs_release_repo_on)
|
1583
|
-
|
1584
|
-
|
1622
|
+
.with(host, 'puppet-nightly', include(
|
1623
|
+
nightly_apt_repo_url: custom_nightlies_url,
|
1624
|
+
))
|
1585
1625
|
subject.install_puppetserver_on(host, nightlies: true, nightly_apt_repo_url: custom_nightlies_url)
|
1586
1626
|
end
|
1587
1627
|
end
|
@@ -1589,47 +1629,44 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1589
1629
|
end
|
1590
1630
|
|
1591
1631
|
describe '#remove_puppet_on' do
|
1592
|
-
supported_platforms
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
'ubuntu-16.04-power8'
|
1608
|
-
]
|
1632
|
+
supported_platforms = ['aix-53-power',
|
1633
|
+
'aix-61-power',
|
1634
|
+
'aix-71-power',
|
1635
|
+
'solaris-10-x86_64',
|
1636
|
+
'solaris-10-x86_64',
|
1637
|
+
'solaris-11-x86_64',
|
1638
|
+
'el-6-x86_64',
|
1639
|
+
'redhat-7-x86_64',
|
1640
|
+
'centos-7-x86_64',
|
1641
|
+
'oracle-7-x86_64',
|
1642
|
+
'scientific-7-x86_64',
|
1643
|
+
'sles-10-x86_64',
|
1644
|
+
'sles-11-x86_64',
|
1645
|
+
'sles-12-s390x',
|
1646
|
+
'ubuntu-16.04-power8',]
|
1609
1647
|
|
1610
1648
|
supported_platforms.each do |platform|
|
1611
|
-
let(:host) { make_host(platform, :
|
1649
|
+
let(:host) { make_host(platform, platform: platform) }
|
1612
1650
|
|
1613
1651
|
pkg_list = 'foo bar'
|
1614
1652
|
|
1615
1653
|
it "uninstalls packages on #{platform}" do
|
1616
|
-
result = Beaker::Result.new(host,'')
|
1654
|
+
result = Beaker::Result.new(host, '')
|
1617
1655
|
result.stdout = pkg_list
|
1618
1656
|
|
1619
1657
|
expected_list = pkg_list
|
1620
1658
|
cmd_args = ''
|
1621
1659
|
|
1622
|
-
expect(
|
1623
|
-
expect(
|
1660
|
+
expect(subject).to receive(:on).exactly(2).times.and_return(result, result)
|
1661
|
+
expect(host).to receive(:uninstall_package).with(expected_list, cmd_args)
|
1624
1662
|
|
1625
|
-
subject.remove_puppet_on(
|
1663
|
+
subject.remove_puppet_on(host)
|
1626
1664
|
end
|
1627
1665
|
end
|
1628
1666
|
|
1629
|
-
let(:debian6) { make_host('debian-6-amd64', :
|
1667
|
+
let(:debian6) { make_host('debian-6-amd64', platform: 'debian-6-amd64') }
|
1630
1668
|
it 'raises error on unsupported platforms' do
|
1631
|
-
expect { subject.remove_puppet_on(
|
1669
|
+
expect { subject.remove_puppet_on(debian6) }.to raise_error(RuntimeError, /unsupported platform/)
|
1632
1670
|
end
|
1633
|
-
|
1634
1671
|
end
|
1635
1672
|
end
|