beaker-puppet 1.29.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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
@@ -10,106 +10,105 @@ class ClassMixedWithDSLInstallUtils
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe ClassMixedWithDSLInstallUtils do
|
13
|
-
let(:hosts)
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
let(:hosts) do
|
14
|
+
make_hosts({ pe_ver: '3.0',
|
15
|
+
platform: 'linux',
|
16
|
+
roles: ['agent'],
|
17
|
+
type: 'foss', }, 4)
|
18
|
+
end
|
17
19
|
|
18
20
|
before :each do
|
19
|
-
allow(
|
21
|
+
allow(subject).to receive(:hosts) { hosts }
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
24
|
describe '#fetch_build_details' do
|
24
|
-
let(
|
25
|
-
let(
|
25
|
+
let(:platform_data) { @platform_data || '' }
|
26
|
+
let(:deets) { { platform_data: platform_data } }
|
26
27
|
|
27
28
|
it 'sets & returns the relative folder' do
|
28
29
|
sha_yaml_folder = '/jams/of/the/rain'
|
29
30
|
sha_yaml_url = "#{sha_yaml_folder}/puns.tgz"
|
30
|
-
expect(
|
31
|
-
expect(
|
31
|
+
expect(subject).to receive(:fetch_http_file)
|
32
|
+
expect(YAML).to receive(:load_file) { deets }
|
32
33
|
|
33
|
-
url,
|
34
|
-
expect(
|
34
|
+
url, = subject.fetch_build_details(sha_yaml_url)
|
35
|
+
expect(url).to be === sha_yaml_folder
|
35
36
|
end
|
36
37
|
|
37
38
|
it 'fetches & returns the build details' do
|
38
39
|
@platform_data = 'test of the man in the can carol?'
|
39
|
-
expect(
|
40
|
-
expect(
|
40
|
+
expect(subject).to receive(:fetch_http_file)
|
41
|
+
expect(YAML).to receive(:load_file) { deets }
|
41
42
|
|
42
|
-
_, hash = subject.fetch_build_details(
|
43
|
-
expect(
|
43
|
+
_, hash = subject.fetch_build_details('sha_yaml_url')
|
44
|
+
expect(hash).to be === @platform_data
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'stores the file in a good location' do
|
47
|
-
allow(
|
48
|
+
allow(YAML).to receive(:load_file) { deets }
|
48
49
|
|
49
50
|
correct_location = '/my/fake/test/dir'
|
50
|
-
expect(
|
51
|
-
expect(
|
51
|
+
expect(Dir).to receive(:mktmpdir) { correct_location }
|
52
|
+
expect(subject).to receive(:fetch_http_file).with(
|
52
53
|
anything, anything, correct_location
|
53
54
|
)
|
54
|
-
subject.fetch_build_details(
|
55
|
+
subject.fetch_build_details('sha_yaml_url')
|
55
56
|
end
|
56
|
-
|
57
57
|
end
|
58
58
|
|
59
59
|
describe '#host_urls' do
|
60
|
-
|
61
|
-
let(
|
62
|
-
let(
|
63
|
-
let(
|
64
|
-
let( :host ) {
|
60
|
+
let(:artifact_path) { @artifact_path || '' }
|
61
|
+
let(:repo_config) { @repo_config || nil }
|
62
|
+
let(:packaging_platform) { @packaging_platform || 'el-7-x86_64' }
|
63
|
+
let(:host) do
|
65
64
|
host = hosts[0]
|
66
|
-
allow(
|
65
|
+
allow(host).to receive(:[]).with(:packaging_platform) {
|
67
66
|
packaging_platform
|
68
67
|
}
|
69
68
|
host
|
70
|
-
|
71
|
-
let(
|
69
|
+
end
|
70
|
+
let(:build_details) do
|
72
71
|
details = {
|
73
72
|
packaging_platform => {
|
74
|
-
:
|
75
|
-
:
|
76
|
-
}
|
73
|
+
artifact: artifact_path,
|
74
|
+
repo_config: repo_config,
|
75
|
+
},
|
77
76
|
}
|
78
77
|
details
|
79
|
-
|
78
|
+
end
|
80
79
|
|
81
80
|
before :each do
|
82
|
-
allow(
|
81
|
+
allow(subject).to receive(:host_packaging_platform) { packaging_platform }
|
83
82
|
end
|
84
83
|
|
85
84
|
it 'fails if there\'s no artifact value for the given platform' do
|
86
|
-
allow(
|
87
|
-
expect
|
88
|
-
subject.host_urls(
|
89
|
-
|
85
|
+
allow(artifact_path).to receive(:nil?) { true }
|
86
|
+
expect do
|
87
|
+
subject.host_urls(host, build_details, '')
|
88
|
+
end.to raise_error(
|
90
89
|
Beaker::DSL::Outcomes::FailTest,
|
91
|
-
/^no artifact.*path found
|
90
|
+
/^no artifact.*path found$/,
|
92
91
|
)
|
93
92
|
end
|
94
93
|
|
95
94
|
it 'fails if the artifact_url doesn\'t exist' do
|
96
|
-
allow(
|
97
|
-
expect
|
98
|
-
subject.host_urls(
|
99
|
-
|
95
|
+
allow(subject).to receive(:link_exists?) { false }
|
96
|
+
expect do
|
97
|
+
subject.host_urls(host, build_details, '')
|
98
|
+
end.to raise_error(
|
100
99
|
Beaker::DSL::Outcomes::FailTest,
|
101
|
-
/^artifact url.*incorrectly
|
100
|
+
/^artifact url.*incorrectly$/,
|
102
101
|
)
|
103
102
|
end
|
104
103
|
|
105
104
|
it 'fails if the host doesn\'t have a packaging_platform' do
|
106
|
-
allow(
|
107
|
-
allow(
|
108
|
-
expect
|
109
|
-
subject.host_urls(
|
110
|
-
|
105
|
+
allow(packaging_platform).to receive(:nil?) { true }
|
106
|
+
allow(host).to receive(:[]).with(:platform) { 'fake-platform' }
|
107
|
+
expect do
|
108
|
+
subject.host_urls(host, build_details, '')
|
109
|
+
end.to raise_error(
|
111
110
|
Beaker::DSL::Outcomes::FailTest,
|
112
|
-
/packaging_platform not provided for host
|
111
|
+
/packaging_platform not provided for host/,
|
113
112
|
)
|
114
113
|
end
|
115
114
|
|
@@ -117,86 +116,84 @@ describe ClassMixedWithDSLInstallUtils do
|
|
117
116
|
base_url = 'base_url/base_url'
|
118
117
|
@artifact_path = 'pants.install.pkg'
|
119
118
|
|
120
|
-
allow(
|
121
|
-
artifact_url,
|
122
|
-
expect(
|
119
|
+
allow(subject).to receive(:link_exists?) { true }
|
120
|
+
artifact_url, = subject.host_urls(host, build_details, base_url)
|
121
|
+
expect(artifact_url).to be === "#{base_url}/#{@artifact_path}"
|
123
122
|
end
|
124
123
|
|
125
124
|
it 'returns a join of the base_url & the platform-specific artifact path' do
|
126
125
|
base_url = 'base_url/base_url'
|
127
126
|
@repo_config = 'pants.install.list'
|
128
127
|
|
129
|
-
allow(
|
130
|
-
_, repoconfig_url = subject.host_urls(
|
131
|
-
expect(
|
128
|
+
allow(subject).to receive(:link_exists?) { true }
|
129
|
+
_, repoconfig_url = subject.host_urls(host, build_details, base_url)
|
130
|
+
expect(repoconfig_url).to be === "#{base_url}/#{@repo_config}"
|
132
131
|
end
|
133
132
|
|
134
133
|
it 'returns nil for the repoconfig_url if one isn\'t provided by the build_details' do
|
135
|
-
allow(
|
136
|
-
_, repoconfig_url = subject.host_urls(
|
137
|
-
expect(
|
134
|
+
allow(subject).to receive(:link_exists?) { true }
|
135
|
+
_, repoconfig_url = subject.host_urls(host, build_details, '')
|
136
|
+
expect(repoconfig_url).to be_nil
|
138
137
|
end
|
139
|
-
|
140
138
|
end
|
141
139
|
|
142
|
-
describe
|
143
|
-
let(
|
144
|
-
let(
|
145
|
-
let(
|
146
|
-
let(
|
140
|
+
describe '#host_packaging_platform' do
|
141
|
+
let(:default_platform) { 'default-platform' }
|
142
|
+
let(:overridden_platform) { 'overridden-platform' }
|
143
|
+
let(:overrides) { 'default-platform=overridden-platform' || @overrides }
|
144
|
+
let(:host) do
|
147
145
|
host = hosts[0]
|
148
|
-
allow(
|
149
|
-
allow(
|
146
|
+
allow(host).to receive(:[]).with(:packaging_platform) { default_platform }
|
147
|
+
allow(host).to receive(:[]).with(:platform) { default_platform }
|
150
148
|
host
|
151
|
-
|
149
|
+
end
|
152
150
|
|
153
151
|
before :each do
|
154
|
-
@original_platforms = ENV
|
152
|
+
@original_platforms = ENV.fetch('BEAKER_PACKAGING_PLATFORMS', nil)
|
155
153
|
end
|
156
154
|
|
157
155
|
after :each do
|
158
156
|
ENV['BEAKER_PACKAGING_PLATFORMS'] = @original_platforms
|
159
157
|
end
|
160
158
|
|
161
|
-
it
|
159
|
+
it 'applies an override to a platform' do
|
162
160
|
ENV['BEAKER_PACKAGING_PLATFORMS'] = overrides
|
163
161
|
expect(subject.host_packaging_platform(host)).to eq(overridden_platform)
|
164
162
|
end
|
165
163
|
|
166
|
-
it
|
164
|
+
it 'applies a list of overrides to a platform' do
|
167
165
|
ENV['BEAKER_PACKAGING_PLATFORMS'] = "aix-7.1-power=aix-6.1-power,#{overrides}"
|
168
166
|
expect(subject.host_packaging_platform(host)).to eq(overridden_platform)
|
169
167
|
end
|
170
168
|
|
171
169
|
it "doesn't apply overrides if the current host's platform isn't overridden" do
|
172
|
-
ENV['BEAKER_PACKAGING_PLATFORMS'] =
|
170
|
+
ENV['BEAKER_PACKAGING_PLATFORMS'] = 'aix-7.1-power=aix-6.1-power'
|
173
171
|
expect(subject.host_packaging_platform(host)).to eq(default_platform)
|
174
172
|
end
|
175
173
|
end
|
176
174
|
|
177
175
|
describe '#install_artifact_on' do
|
178
|
-
|
179
|
-
let(
|
180
|
-
let(
|
181
|
-
let(
|
182
|
-
let( :mock_platform ) {
|
176
|
+
let(:artifact_url) { 'url://in/the/jungle/lies/the/prize.pnc' }
|
177
|
+
let(:platform) { @platform || 'linux' }
|
178
|
+
let(:version) { @version || '' }
|
179
|
+
let(:mock_platform) do
|
183
180
|
mock_platform = Object.new
|
184
|
-
allow(
|
181
|
+
allow(mock_platform).to receive(:to_array) { [platform, version, '', ''] }
|
185
182
|
mock_platform
|
186
|
-
|
187
|
-
let(
|
183
|
+
end
|
184
|
+
let(:host) do
|
188
185
|
host = hosts[0]
|
189
|
-
allow(
|
186
|
+
allow(host).to receive(:[]).with(:platform) { mock_platform }
|
190
187
|
host
|
191
|
-
|
188
|
+
end
|
192
189
|
|
193
190
|
it 'calls host.install_package in the common case' do
|
194
|
-
expect(
|
195
|
-
expect(
|
196
|
-
expect(
|
197
|
-
expect(
|
191
|
+
expect(subject).to receive(:fetch_http_file).never
|
192
|
+
expect(subject).to receive(:on).never
|
193
|
+
expect(host).to receive(:install_local_package).never
|
194
|
+
expect(host).to receive(:install_package).once
|
198
195
|
|
199
|
-
subject.install_artifact_on(
|
196
|
+
subject.install_artifact_on(host, artifact_url, 'project_name')
|
200
197
|
end
|
201
198
|
|
202
199
|
it 'installs from a file on EOS' do
|
@@ -225,178 +222,173 @@ describe ClassMixedWithDSLInstallUtils do
|
|
225
222
|
end
|
226
223
|
|
227
224
|
context 'local install cases' do
|
228
|
-
|
229
225
|
def run_shared_test_steps
|
230
|
-
expect(
|
231
|
-
expect(
|
232
|
-
subject.install_artifact_on(
|
226
|
+
expect(host).to receive(:install_local_package).once
|
227
|
+
expect(host).to receive(:install_package).never
|
228
|
+
subject.install_artifact_on(host, artifact_url, 'project_name')
|
233
229
|
end
|
234
230
|
|
235
231
|
it 'SOLARIS: fetches the file & runs local install' do
|
236
232
|
@platform = 'solaris'
|
237
233
|
|
238
|
-
expect(
|
239
|
-
expect(
|
240
|
-
run_shared_test_steps
|
234
|
+
expect(subject).to receive(:fetch_http_file).once
|
235
|
+
expect(subject).to receive(:scp_to).once
|
236
|
+
run_shared_test_steps
|
241
237
|
end
|
242
238
|
|
243
239
|
it 'OSX: curls the file & runs local install' do
|
244
240
|
@platform = 'osx'
|
245
241
|
|
246
|
-
expect(
|
247
|
-
run_shared_test_steps
|
242
|
+
expect(subject).to receive(:on).with(host, /^curl.*#{artifact_url}$/)
|
243
|
+
run_shared_test_steps
|
248
244
|
end
|
249
245
|
|
250
246
|
it 'AIX: fetches the file & runs local install' do
|
251
247
|
@platform = 'aix'
|
252
248
|
@version = '7.2'
|
253
249
|
|
254
|
-
expect(
|
255
|
-
expect(
|
256
|
-
expect(
|
250
|
+
expect(subject).to receive(:fetch_http_file).once
|
251
|
+
expect(subject).to receive(:scp_to).once
|
252
|
+
expect(subject).to receive(:on).with(host, /^rpm -ivh --ignoreos .*#{File.basename(artifact_url)}$/).once
|
257
253
|
|
258
|
-
expect(
|
259
|
-
expect(
|
260
|
-
subject.install_artifact_on(
|
254
|
+
expect(host).to receive(:install_local_package).never
|
255
|
+
expect(host).to receive(:install_package).never
|
256
|
+
subject.install_artifact_on(host, artifact_url, 'project_name')
|
261
257
|
end
|
262
258
|
|
263
259
|
it 'AIX 6.1: fetches the file & runs local install' do
|
264
260
|
@platform = 'aix'
|
265
261
|
@version = '6.1'
|
266
262
|
|
267
|
-
expect(
|
268
|
-
expect(
|
269
|
-
expect(
|
270
|
-
expect(
|
263
|
+
expect(subject).to receive(:fetch_http_file).once
|
264
|
+
expect(subject).to receive(:scp_to).once
|
265
|
+
expect(subject).to receive(:on).with(host, /^rpm -ivh .*#{File.basename(artifact_url)}$/).once
|
266
|
+
expect(subject).not_to receive(:on).with(host, /^rpm -ivh --ignoreos .*#{File.basename(artifact_url)}$/)
|
271
267
|
|
272
|
-
expect(
|
273
|
-
expect(
|
274
|
-
subject.install_artifact_on(
|
268
|
+
expect(host).to receive(:install_local_package).never
|
269
|
+
expect(host).to receive(:install_package).never
|
270
|
+
subject.install_artifact_on(host, artifact_url, 'project_name')
|
275
271
|
end
|
276
|
-
|
277
272
|
end
|
278
|
-
|
279
273
|
end
|
280
274
|
|
281
275
|
describe '#install_repo_configs_on' do
|
282
|
-
let(
|
276
|
+
let(:host) { hosts[0] }
|
283
277
|
|
284
278
|
it 'passes the parameters through to #install_repo_configs_from_url' do
|
285
279
|
repoconfig_url = 'string/test/repo_config/stuff.stuff'
|
286
|
-
expect(
|
280
|
+
expect(subject).to receive(:install_repo_configs_from_url).with(
|
287
281
|
host,
|
288
|
-
repoconfig_url
|
282
|
+
repoconfig_url,
|
289
283
|
)
|
290
|
-
expect(
|
291
|
-
subject.install_repo_configs_on(
|
284
|
+
expect(subject.logger).to receive(:warn).never
|
285
|
+
subject.install_repo_configs_on(host, repoconfig_url)
|
292
286
|
end
|
293
287
|
|
294
288
|
it 'returns without calling #install_repo_configs_from_url if repoconfig_url is nil' do
|
295
|
-
expect(
|
296
|
-
expect(
|
297
|
-
/^No repo_config.*Skipping repo_config install
|
289
|
+
expect(subject).to receive(:install_repo_configs_from_url).never
|
290
|
+
expect(subject.logger).to receive(:warn).with(
|
291
|
+
/^No repo_config.*Skipping repo_config install$/,
|
298
292
|
)
|
299
|
-
subject.install_repo_configs_on(
|
293
|
+
subject.install_repo_configs_on(host, nil)
|
300
294
|
end
|
301
295
|
end
|
302
296
|
|
303
297
|
describe '#install_from_build_data_url' do
|
304
|
-
|
305
298
|
before :each do
|
306
|
-
allow(
|
299
|
+
allow(subject).to receive(:link_exists?) { true }
|
307
300
|
end
|
308
301
|
|
309
302
|
it 'only calls #fetch_build_details once' do
|
310
|
-
allow(
|
311
|
-
allow(
|
312
|
-
allow(
|
303
|
+
allow(subject).to receive(:host_urls)
|
304
|
+
allow(subject).to receive(:install_artifact_on)
|
305
|
+
allow(subject).to receive(:configure_type_defaults_on)
|
313
306
|
|
314
|
-
expect(
|
315
|
-
subject.install_from_build_data_url(
|
307
|
+
expect(subject).to receive(:fetch_build_details).once
|
308
|
+
subject.install_from_build_data_url('project_name', 'project_sha')
|
316
309
|
end
|
317
310
|
|
318
311
|
it 'calls #configure_type_defaults_on all hosts' do
|
319
|
-
allow(
|
320
|
-
allow(
|
321
|
-
allow(
|
312
|
+
allow(subject).to receive(:fetch_build_details)
|
313
|
+
allow(subject).to receive(:host_urls)
|
314
|
+
allow(subject).to receive(:install_artifact_on)
|
322
315
|
|
323
316
|
hosts.each do |host|
|
324
|
-
expect(
|
317
|
+
expect(subject).to receive(:configure_type_defaults_on).with(host).once
|
325
318
|
end
|
326
|
-
subject.install_from_build_data_url(
|
319
|
+
subject.install_from_build_data_url('project_name', 'project_sha')
|
327
320
|
end
|
328
321
|
|
329
322
|
it 'calls #configure_type_defaults_on one host if set' do
|
330
|
-
allow(
|
331
|
-
allow(
|
332
|
-
allow(
|
323
|
+
allow(subject).to receive(:fetch_build_details)
|
324
|
+
allow(subject).to receive(:host_urls)
|
325
|
+
allow(subject).to receive(:install_artifact_on)
|
333
326
|
|
334
|
-
expect(
|
335
|
-
subject.install_from_build_data_url(
|
327
|
+
expect(subject).to receive(:configure_type_defaults_on).with(hosts[0]).once
|
328
|
+
subject.install_from_build_data_url('project_name', 'project_sha', hosts[0])
|
336
329
|
end
|
337
330
|
|
338
331
|
it 'calls #configure_type_defaults_on custom array of hosts if set' do
|
339
|
-
allow(
|
340
|
-
allow(
|
341
|
-
allow(
|
332
|
+
allow(subject).to receive(:fetch_build_details)
|
333
|
+
allow(subject).to receive(:host_urls)
|
334
|
+
allow(subject).to receive(:install_artifact_on)
|
342
335
|
|
343
336
|
custom_host_list = hosts.sample(1 + rand(hosts.count))
|
344
337
|
|
345
338
|
custom_host_list.each do |host|
|
346
|
-
expect(
|
339
|
+
expect(subject).to receive(:configure_type_defaults_on).with(host).once
|
347
340
|
end
|
348
|
-
subject.install_from_build_data_url(
|
341
|
+
subject.install_from_build_data_url('project_name', 'project_sha', custom_host_list)
|
349
342
|
end
|
350
343
|
|
351
344
|
it 'passes the artifact_url from #hosts_artifact_url to #install_artifact_on' do
|
352
|
-
allow(
|
353
|
-
allow(
|
345
|
+
allow(subject).to receive(:fetch_build_details)
|
346
|
+
allow(subject).to receive(:configure_type_defaults_on)
|
354
347
|
|
355
348
|
artifact_url = 'url://in/my/shoe/lies/the/trophy.jnk'
|
356
|
-
allow(
|
357
|
-
|
349
|
+
allow(subject).to receive(:host_urls) { artifact_url }
|
358
350
|
|
359
|
-
expect(
|
351
|
+
expect(subject).to receive(:install_artifact_on).with(
|
360
352
|
anything, artifact_url, anything
|
361
|
-
).exactly(
|
362
|
-
subject.install_from_build_data_url('project_name', 'project_sha'
|
353
|
+
).exactly(hosts.length).times
|
354
|
+
subject.install_from_build_data_url('project_name', 'project_sha')
|
363
355
|
end
|
364
356
|
|
365
357
|
it 'fails properly if the given sha_yaml_url doesn\'t exist' do
|
366
|
-
allow(
|
358
|
+
allow(subject).to receive(:link_exists?) { false }
|
367
359
|
sha_yaml_url = 'pants/to/the/man/jeans.txt'
|
368
360
|
|
369
|
-
expect
|
370
|
-
subject.install_from_build_data_url(
|
371
|
-
|
361
|
+
expect do
|
362
|
+
subject.install_from_build_data_url('project_name', sha_yaml_url)
|
363
|
+
end.to raise_error(Beaker::DSL::Outcomes::FailTest, /project_name.*#{sha_yaml_url}/)
|
372
364
|
end
|
373
365
|
|
374
366
|
it 'runs host.install_package instead of #install_artifact_on if theres a repo_config' do
|
375
367
|
repoconfig_url = 'pants/man/shoot/to/the/stars'
|
376
368
|
project_name = 'fake_project_66'
|
377
|
-
allow(
|
378
|
-
allow(
|
379
|
-
allow(
|
369
|
+
allow(subject).to receive(:fetch_build_details)
|
370
|
+
allow(subject).to receive(:configure_type_defaults_on)
|
371
|
+
allow(subject).to receive(:host_urls) { ['', repoconfig_url] }
|
380
372
|
|
381
|
-
expect(
|
373
|
+
expect(subject).to receive(:install_artifact_on).never
|
382
374
|
hosts.each do |host|
|
383
|
-
expect(
|
375
|
+
expect(subject).to receive(:install_repo_configs_on).with(
|
384
376
|
host,
|
385
|
-
repoconfig_url
|
377
|
+
repoconfig_url,
|
386
378
|
)
|
387
|
-
expect(
|
379
|
+
expect(host).to receive(:install_package).with(project_name)
|
388
380
|
end
|
389
|
-
subject.install_from_build_data_url(
|
381
|
+
subject.install_from_build_data_url(project_name, 'sha_yaml_url')
|
390
382
|
end
|
391
383
|
end
|
392
384
|
|
393
385
|
describe '#install_puppet_agent_from_dev_builds_on' do
|
394
386
|
let(:host) { make_host('test_host', { platform: 'el-7-x86_64' }) }
|
395
|
-
let(:ref) {
|
387
|
+
let(:ref) { 'sha' }
|
396
388
|
let(:sha_yaml_url) { "#{Beaker::DSL::Puppet5::DEFAULT_DEV_BUILDS_URL}/puppet-agent/#{ref}/artifacts/#{ref}.yaml" }
|
397
389
|
|
398
390
|
it 'installs puppet-agent from internal builds when they are accessible' do
|
399
|
-
expect(
|
391
|
+
expect(subject).to receive(:block_on).with(anything, run_in_parallel: true)
|
400
392
|
allow(subject).to receive(:dev_builds_accessible_on?).and_return(true)
|
401
393
|
allow(subject).to receive(:install_from_build_data_url).with('puppet-agent', sha_yaml_url, host)
|
402
394
|
subject.install_puppet_agent_from_dev_builds_on(host, ref)
|
@@ -404,9 +396,11 @@ describe ClassMixedWithDSLInstallUtils do
|
|
404
396
|
end
|
405
397
|
|
406
398
|
it 'fails the test when internal builds are inaccessible' do
|
407
|
-
expect(
|
399
|
+
expect(subject).to receive(:block_on).with(anything, run_in_parallel: true)
|
408
400
|
allow(subject).to receive(:dev_builds_accessible?).and_return(false)
|
409
|
-
expect
|
401
|
+
expect do
|
402
|
+
subject.install_puppet_agent_from_dev_builds_on(host, 'sha')
|
403
|
+
end.to raise_error(Beaker::DSL::Outcomes::FailTest)
|
410
404
|
end
|
411
405
|
end
|
412
406
|
end
|