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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/release.yml +2 -2
  4. data/.github/workflows/test.yml +28 -7
  5. data/.rubocop.yml +5 -0
  6. data/.rubocop_todo.yml +842 -0
  7. data/CHANGELOG.md +31 -0
  8. data/Gemfile +5 -20
  9. data/Rakefile +64 -169
  10. data/acceptance/config/acceptance-options.rb +3 -3
  11. data/acceptance/config/gem/acceptance-options.rb +8 -8
  12. data/acceptance/config/git/acceptance-options.rb +8 -8
  13. data/acceptance/config/pkg/acceptance-options.rb +7 -7
  14. data/acceptance/pre_suite/gem/install.rb +6 -6
  15. data/acceptance/pre_suite/git/install.rb +22 -22
  16. data/acceptance/pre_suite/pkg/install.rb +3 -3
  17. data/acceptance/tests/backwards_compatible.rb +6 -7
  18. data/acceptance/tests/clone_git_repo_on_test.rb +12 -13
  19. data/acceptance/tests/create_tmpdir_on_test.rb +13 -9
  20. data/acceptance/tests/install_smoke_test.rb +5 -4
  21. data/acceptance/tests/stub_host.rb +11 -10
  22. data/acceptance/tests/web_helpers_test.rb +11 -10
  23. data/beaker-puppet.gemspec +16 -23
  24. data/bin/beaker-puppet +2 -4
  25. data/lib/beaker-puppet/helpers/facter_helpers.rb +9 -7
  26. data/lib/beaker-puppet/helpers/host_helpers.rb +10 -7
  27. data/lib/beaker-puppet/helpers/puppet_helpers.rb +151 -160
  28. data/lib/beaker-puppet/helpers/rake_helpers.rb +1 -1
  29. data/lib/beaker-puppet/helpers/tk_helpers.rb +22 -28
  30. data/lib/beaker-puppet/install_utils/aio_defaults.rb +39 -43
  31. data/lib/beaker-puppet/install_utils/ezbake_utils.rb +34 -42
  32. data/lib/beaker-puppet/install_utils/foss_defaults.rb +134 -138
  33. data/lib/beaker-puppet/install_utils/foss_utils.rb +293 -320
  34. data/lib/beaker-puppet/install_utils/module_utils.rb +58 -70
  35. data/lib/beaker-puppet/install_utils/puppet5.rb +30 -35
  36. data/lib/beaker-puppet/install_utils/puppet_utils.rb +58 -68
  37. data/lib/beaker-puppet/install_utils/windows_utils.rb +34 -36
  38. data/lib/beaker-puppet/version.rb +1 -1
  39. data/lib/beaker-puppet/wrappers.rb +13 -14
  40. data/lib/beaker-puppet.rb +4 -5
  41. data/setup/aio/010_Install_Puppet_Agent.rb +5 -6
  42. data/setup/common/000-delete-puppet-when-none.rb +2 -4
  43. data/setup/common/003_solaris_cert_fix.rb +74 -70
  44. data/setup/common/005_redhat_subscription_fix.rb +3 -2
  45. data/setup/common/011_Install_Puppet_Server.rb +7 -9
  46. data/setup/common/012_Finalize_Installs.rb +5 -5
  47. data/setup/common/025_StopFirewall.rb +1 -1
  48. data/setup/common/030_StopSssd.rb +2 -2
  49. data/setup/common/040_ValidateSignCert.rb +10 -12
  50. data/setup/common/045_EnsureMasterStarted.rb +2 -2
  51. data/setup/gem/010_GemInstall.rb +5 -4
  52. data/setup/git/000_EnvSetup.rb +48 -48
  53. data/setup/git/010_TestSetup.rb +13 -12
  54. data/setup/git/020_PuppetUserAndGroup.rb +3 -2
  55. data/setup/git/060_InstallModules.rb +14 -14
  56. data/setup/git/070_InstallCACerts.rb +82 -82
  57. data/spec/beaker-puppet/helpers/facter_helpers_spec.rb +22 -24
  58. data/spec/beaker-puppet/helpers/host_helpers_spec.rb +10 -6
  59. data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +506 -517
  60. data/spec/beaker-puppet/helpers/tk_helpers_spec.rb +20 -24
  61. data/spec/beaker-puppet/install_utils/ezbake_utils_spec.rb +86 -90
  62. data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +636 -599
  63. data/spec/beaker-puppet/install_utils/module_utils_spec.rb +125 -116
  64. data/spec/beaker-puppet/install_utils/puppet5_spec.rb +159 -165
  65. data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +92 -77
  66. data/spec/beaker-puppet/install_utils/windows_utils_spec.rb +101 -89
  67. data/spec/beaker-puppet/wrappers_spec.rb +10 -10
  68. data/spec/helpers.rb +85 -91
  69. data/tasks/ci.rake +171 -179
  70. metadata +33 -62
  71. data/setup/common/020_InstallCumulusModules.rb +0 -13
  72. data/setup/common/021_InstallAristaModuleMasters.rb +0 -12
  73. 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) { make_hosts( { :pe_ver => '3.0',
14
- :platform => 'linux',
15
- :roles => [ 'agent' ],
16
- :type => 'foss' }, 4 ) }
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( subject ).to receive( :hosts ) { hosts }
21
+ allow(subject).to receive(:hosts) { hosts }
20
22
  end
21
23
 
22
-
23
24
  describe '#fetch_build_details' do
24
- let( :platform_data ) { @platform_data || '' }
25
- let( :deets ) { { :platform_data => platform_data } }
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( subject ).to receive( :fetch_http_file )
31
- expect( YAML ).to receive( :load_file ) { deets }
31
+ expect(subject).to receive(:fetch_http_file)
32
+ expect(YAML).to receive(:load_file) { deets }
32
33
 
33
- url, _ = subject.fetch_build_details( sha_yaml_url )
34
- expect( url ).to be === sha_yaml_folder
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( subject ).to receive( :fetch_http_file )
40
- expect( YAML ).to receive( :load_file ) { deets }
40
+ expect(subject).to receive(:fetch_http_file)
41
+ expect(YAML).to receive(:load_file) { deets }
41
42
 
42
- _, hash = subject.fetch_build_details( 'sha_yaml_url' )
43
- expect( hash ).to be === @platform_data
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( YAML ).to receive( :load_file ) { deets }
48
+ allow(YAML).to receive(:load_file) { deets }
48
49
 
49
50
  correct_location = '/my/fake/test/dir'
50
- expect( Dir ).to receive( :mktmpdir ) { correct_location }
51
- expect( subject ).to receive( :fetch_http_file ).with(
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( 'sha_yaml_url' )
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( :artifact_path ) { @artifact_path || '' }
62
- let( :repo_config ) { @repo_config || nil }
63
- let( :packaging_platform ) { @packaging_platform || 'el-7-x86_64' }
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( host ).to receive( :[] ).with( :packaging_platform ) {
65
+ allow(host).to receive(:[]).with(:packaging_platform) {
67
66
  packaging_platform
68
67
  }
69
68
  host
70
- }
71
- let( :build_details ) {
69
+ end
70
+ let(:build_details) do
72
71
  details = {
73
72
  packaging_platform => {
74
- :artifact => artifact_path,
75
- :repo_config => repo_config
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( subject ).to receive( :host_packaging_platform ) { packaging_platform }
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( artifact_path ).to receive( :nil? ) { true }
87
- expect {
88
- subject.host_urls( host, build_details, '' )
89
- }.to raise_error(
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( subject ).to receive( :link_exists? ) { false }
97
- expect {
98
- subject.host_urls( host, build_details, '' )
99
- }.to raise_error(
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( packaging_platform ).to receive( :nil? ) { true }
107
- allow( host ).to receive( :[] ).with( :platform ) { 'fake-platform' }
108
- expect {
109
- subject.host_urls( host, build_details, '' )
110
- }.to raise_error(
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( subject ).to receive( :link_exists? ) { true }
121
- artifact_url, _ = subject.host_urls( host, build_details, base_url )
122
- expect( artifact_url ).to be === "#{base_url}/#{@artifact_path}"
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( subject ).to receive( :link_exists? ) { true }
130
- _, repoconfig_url = subject.host_urls( host, build_details, base_url )
131
- expect( repoconfig_url ).to be === "#{base_url}/#{@repo_config}"
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( subject ).to receive( :link_exists? ) { true }
136
- _, repoconfig_url = subject.host_urls( host, build_details, '' )
137
- expect( repoconfig_url ).to be_nil
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 "#host_packaging_platform" do
143
- let( :default_platform ) { 'default-platform' }
144
- let( :overridden_platform ) { 'overridden-platform' }
145
- let( :overrides ) { 'default-platform=overridden-platform' || @overrides }
146
- let( :host ) {
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( host ).to receive( :[] ).with( :packaging_platform ) { default_platform }
149
- allow( host ).to receive( :[] ).with( :platform ) { default_platform }
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['BEAKER_PACKAGING_PLATFORMS']
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 "applies an override to a platform" do
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 "applies a list of overrides to a platform" do
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'] = "aix-7.1-power=aix-6.1-power"
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( :artifact_url ) { 'url://in/the/jungle/lies/the/prize.pnc' }
180
- let( :platform ) { @platform || 'linux' }
181
- let( :version ) { @version || '' }
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( mock_platform ).to receive( :to_array ) { [platform, version, '', ''] }
181
+ allow(mock_platform).to receive(:to_array) { [platform, version, '', ''] }
185
182
  mock_platform
186
- }
187
- let( :host ) {
183
+ end
184
+ let(:host) do
188
185
  host = hosts[0]
189
- allow( host ).to receive( :[] ).with( :platform ) { mock_platform }
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( subject ).to receive( :fetch_http_file ).never
195
- expect( subject ).to receive( :on ).never
196
- expect( host ).to receive( :install_local_package ).never
197
- expect( host ).to receive( :install_package ).once
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( host, artifact_url, 'project_name' )
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( host ).to receive( :install_local_package ).once
231
- expect( host ).to receive( :install_package ).never
232
- subject.install_artifact_on( host, artifact_url, 'project_name' )
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( subject ).to receive( :fetch_http_file ).once
239
- expect( subject ).to receive( :scp_to ).once
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( subject ).to receive( :on ).with( host, /^curl.*#{artifact_url}$/ )
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( subject ).to receive( :fetch_http_file ).once
255
- expect( subject ).to receive( :scp_to ).once
256
- expect( subject ).to receive( :on ).with( host, /^rpm -ivh --ignoreos .*#{File.basename(artifact_url)}$/ ).once
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( host ).to receive( :install_local_package ).never
259
- expect( host ).to receive( :install_package ).never
260
- subject.install_artifact_on( host, artifact_url, 'project_name' )
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( subject ).to receive( :fetch_http_file ).once
268
- expect( subject ).to receive( :scp_to ).once
269
- expect( subject ).to receive( :on ).with( host, /^rpm -ivh .*#{File.basename(artifact_url)}$/ ).once
270
- expect( subject ).not_to receive( :on ).with( host, /^rpm -ivh --ignoreos .*#{File.basename(artifact_url)}$/ )
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( host ).to receive( :install_local_package ).never
273
- expect( host ).to receive( :install_package ).never
274
- subject.install_artifact_on( host, artifact_url, 'project_name' )
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( :host ) { hosts[0] }
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( subject ).to receive( :install_repo_configs_from_url ).with(
280
+ expect(subject).to receive(:install_repo_configs_from_url).with(
287
281
  host,
288
- repoconfig_url
282
+ repoconfig_url,
289
283
  )
290
- expect( subject.logger ).to receive( :warn ).never
291
- subject.install_repo_configs_on( host, repoconfig_url )
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( subject ).to receive( :install_repo_configs_from_url ).never
296
- expect( subject.logger ).to receive( :warn ).with(
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( host, nil )
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( subject ).to receive( :link_exists? ) { true }
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( subject ).to receive( :host_urls )
311
- allow( subject ).to receive( :install_artifact_on )
312
- allow( subject ).to receive( :configure_type_defaults_on )
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( subject ).to receive( :fetch_build_details ).once
315
- subject.install_from_build_data_url( 'project_name', 'project_sha' )
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( subject ).to receive( :fetch_build_details )
320
- allow( subject ).to receive( :host_urls )
321
- allow( subject ).to receive( :install_artifact_on )
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( subject ).to receive( :configure_type_defaults_on ).with( host ).once
317
+ expect(subject).to receive(:configure_type_defaults_on).with(host).once
325
318
  end
326
- subject.install_from_build_data_url( 'project_name', 'project_sha' )
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( subject ).to receive( :fetch_build_details )
331
- allow( subject ).to receive( :host_urls )
332
- allow( subject ).to receive( :install_artifact_on )
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( subject ).to receive( :configure_type_defaults_on ).with( hosts[0] ).once
335
- subject.install_from_build_data_url( 'project_name', 'project_sha', hosts[0] )
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( subject ).to receive( :fetch_build_details )
340
- allow( subject ).to receive( :host_urls )
341
- allow( subject ).to receive( :install_artifact_on )
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( subject ).to receive( :configure_type_defaults_on ).with( host ).once
339
+ expect(subject).to receive(:configure_type_defaults_on).with(host).once
347
340
  end
348
- subject.install_from_build_data_url( 'project_name', 'project_sha', custom_host_list )
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( subject ).to receive( :fetch_build_details )
353
- allow( subject ).to receive( :configure_type_defaults_on )
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( subject ).to receive( :host_urls ) { artifact_url }
357
-
349
+ allow(subject).to receive(:host_urls) { artifact_url }
358
350
 
359
- expect( subject ).to receive( :install_artifact_on ).with(
351
+ expect(subject).to receive(:install_artifact_on).with(
360
352
  anything, artifact_url, anything
361
- ).exactly( hosts.length ).times
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( subject ).to receive( :link_exists? ) { false }
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( 'project_name', sha_yaml_url )
371
- }.to raise_error(Beaker::DSL::Outcomes::FailTest, /project_name.*#{sha_yaml_url}/)
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( subject ).to receive( :fetch_build_details )
378
- allow( subject ).to receive( :configure_type_defaults_on )
379
- allow( subject ).to receive( :host_urls ) { ['', repoconfig_url] }
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( subject ).to receive( :install_artifact_on ).never
373
+ expect(subject).to receive(:install_artifact_on).never
382
374
  hosts.each do |host|
383
- expect( subject ).to receive( :install_repo_configs_on ).with(
375
+ expect(subject).to receive(:install_repo_configs_on).with(
384
376
  host,
385
- repoconfig_url
377
+ repoconfig_url,
386
378
  )
387
- expect( host ).to receive( :install_package ).with( project_name )
379
+ expect(host).to receive(:install_package).with(project_name)
388
380
  end
389
- subject.install_from_build_data_url( project_name, 'sha_yaml_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) { "sha" }
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( subject ).to receive(:block_on).with(anything, :run_in_parallel => true)
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( subject ).to receive(:block_on).with(anything, :run_in_parallel => true)
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 { subject.install_puppet_agent_from_dev_builds_on(host, 'sha') }.to raise_error(Beaker::DSL::Outcomes::FailTest)
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