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
data/tasks/ci.rake CHANGED
@@ -20,121 +20,121 @@ CLEAN.include('*.tar', REPO_CONFIGS_DIR, 'tmp', '.beaker', 'log', 'junit')
20
20
  DEFAULT_MASTER_TEST_TARGET = 'redhat7-64m'
21
21
  DEFAULT_TEST_TARGETS = "#{DEFAULT_MASTER_TEST_TARGET}a-windows2012r2-64a"
22
22
 
23
- USAGE = <<-EOS
24
- Usage: bundle exec rake <target> [arguments]
23
+ USAGE = <<~EOS
24
+ Usage: bundle exec rake <target> [arguments]
25
25
 
26
- where <target> is one of:
26
+ where <target> is one of:
27
27
 
28
- ci:test:setup
29
- ci:test:git
30
- ci:test:aio
31
- ci:test:gem
28
+ ci:test:setup
29
+ ci:test:git
30
+ ci:test:aio
31
+ ci:test:gem
32
32
 
33
- See `bundle exec rake -D <target>` for information about each target. Each rake
34
- task accepts the following environment variables:
33
+ See `bundle exec rake -D <target>` for information about each target. Each rake
34
+ task accepts the following environment variables:
35
35
 
36
- REQUIRED
37
- --------
36
+ REQUIRED
37
+ --------
38
38
 
39
- SHA:
40
- The git SHA of either the puppet-agent package or component repo must be
41
- specified depending on the target. The `git` and `gem` use the component
42
- SHA, where as `aio` uses the puppet-agent package SHA.
39
+ SHA:
40
+ The git SHA of either the puppet-agent package or component repo must be
41
+ specified depending on the target. The `git` and `gem` use the component
42
+ SHA, where as `aio` uses the puppet-agent package SHA.
43
43
 
44
- OPTIONAL
45
- --------
44
+ OPTIONAL
45
+ --------
46
46
 
47
- HOSTS:
48
- The hosts to run against. Must be specified as a path to a file or a
49
- beaker-hostgenerator string. Defaults to #{DEFAULT_TEST_TARGETS}.
47
+ HOSTS:
48
+ The hosts to run against. Must be specified as a path to a file or a
49
+ beaker-hostgenerator string. Defaults to #{DEFAULT_TEST_TARGETS}.
50
50
 
51
- HOSTS=mynodes.yaml
52
- HOSTS=redhat7-64ma
51
+ HOSTS=mynodes.yaml
52
+ HOSTS=redhat7-64ma
53
53
 
54
- TESTS:
55
- A comma-delimited list of files/directories containing tests to run.
56
- Defaults to running all tests.
54
+ TESTS:
55
+ A comma-delimited list of files/directories containing tests to run.
56
+ Defaults to running all tests.
57
57
 
58
- TESTS=tests/cycle_detection.rb
59
- TESTS=tests/pluginsync,tests/language
58
+ TESTS=tests/cycle_detection.rb
59
+ TESTS=tests/pluginsync,tests/language
60
60
 
61
- OPTIONS:
62
- Additional options to pass to beaker. Defaults to ''.
61
+ OPTIONS:
62
+ Additional options to pass to beaker. Defaults to ''.
63
63
 
64
- OPTIONS='--dry-run --no-color'
64
+ OPTIONS='--dry-run --no-color'
65
65
 
66
- BEAKER_HOSTS:
67
- Same as HOSTS.
66
+ BEAKER_HOSTS:
67
+ Same as HOSTS.
68
68
 
69
- TEST_TARGET:
70
- A beaker-hostgenerator string of agent-only hosts to run against.
71
- The MASTER_TEST_TARGET host will be added this list. This option is
72
- only intended to be used in CI.
69
+ TEST_TARGET:
70
+ A beaker-hostgenerator string of agent-only hosts to run against.
71
+ The MASTER_TEST_TARGET host will be added this list. This option is
72
+ only intended to be used in CI.
73
73
 
74
- MASTER_TEST_TARGET:
75
- Override the default master test target. Should only be used with
76
- TEST_TARGET, and is only intended to be used in CI. Defaults to
77
- #{DEFAULT_MASTER_TEST_TARGET}.
74
+ MASTER_TEST_TARGET:
75
+ Override the default master test target. Should only be used with
76
+ TEST_TARGET, and is only intended to be used in CI. Defaults to
77
+ #{DEFAULT_MASTER_TEST_TARGET}.
78
78
 
79
- DEV_BUILDS_URL:
80
- Override the url where we look for development builds of packages to test.
81
- Defaults to https://builds.delivery.puppetlabs.net
79
+ DEV_BUILDS_URL:
80
+ Override the url where we look for development builds of packages to test.
81
+ Defaults to https://builds.delivery.puppetlabs.net
82
82
 
83
- NIGHTLY_BUILDS_URL:
84
- Override the url where we look for nightly builds of packages to test.
85
- Defaults to https://nightlies.puppet.com
83
+ NIGHTLY_BUILDS_URL:
84
+ Override the url where we look for nightly builds of packages to test.
85
+ Defaults to https://nightlies.puppet.com
86
86
 
87
- RELEASE_STREAM
88
- The release stream for the puppet family you want to test. This defaults to 'puppet',
89
- which is the current latest release stream. Other options are currently published streams
90
- like 'puppet5' or 'puppet6'. This is currently only used when accessing repos on
91
- nightlies.puppet.com
87
+ RELEASE_STREAM
88
+ The release stream for the puppet family you want to test. This defaults to 'puppet',
89
+ which is the current latest release stream. Other options are currently published streams
90
+ like 'puppet5' or 'puppet6'. This is currently only used when accessing repos on
91
+ nightlies.puppet.com
92
92
 
93
- SERVER_VERSION:
94
- The version of puppetserver to test against. This defaults to 'latest' if unset.
95
- When it defaults to latest, it will attept to pull packages from NIGHTLY_BUILDS_URL
96
- from the RELEASE_STREAM repo.
93
+ SERVER_VERSION:
94
+ The version of puppetserver to test against. This defaults to 'latest' if unset.
95
+ When it defaults to latest, it will attept to pull packages from NIGHTLY_BUILDS_URL
96
+ from the RELEASE_STREAM repo.
97
97
 
98
- FORK:
99
- Used to build a github url. If unset, this defaults to 'puppetlabs'. This can be used to
100
- point acceptance to pull a repo to test from a personal fork.
98
+ FORK:
99
+ Used to build a github url. If unset, this defaults to 'puppetlabs'. This can be used to
100
+ point acceptance to pull a repo to test from a personal fork.
101
101
 
102
- $project_FORK:
103
- Similar to FORK, but project specific. If you have only one project (i.e., hiera) that you
104
- wanted to test from a different fork then all the others, you could set HIERA_FORK=melissa,
105
- you would get back 'https://github.com/melissa/hiera.git'.
102
+ $project_FORK:
103
+ Similar to FORK, but project specific. If you have only one project (i.e., hiera) that you
104
+ wanted to test from a different fork then all the others, you could set HIERA_FORK=melissa,
105
+ you would get back 'https://github.com/melissa/hiera.git'.
106
106
 
107
- SERVER:
108
- Used to build a github url. If unset, this defaults to 'github.com'. This can be used to
109
- pull a github repo from a unique server location.
107
+ SERVER:
108
+ Used to build a github url. If unset, this defaults to 'github.com'. This can be used to
109
+ pull a github repo from a unique server location.
110
110
 
111
- $project_SERVER:
112
- Similar to SERVER, but project specific. If you have only one project (i.e., hiera) that you
113
- want to pull from a different server then all the others, you could set HIERA_SERVER=192.0.2.1,
114
- and you would get back 'https://192.0.2.1/puppetlabs-hiera.git'.
111
+ $project_SERVER:
112
+ Similar to SERVER, but project specific. If you have only one project (i.e., hiera) that you
113
+ want to pull from a different server then all the others, you could set HIERA_SERVER=192.0.2.1,
114
+ and you would get back 'https://192.0.2.1/puppetlabs-hiera.git'.
115
115
 
116
- RUNTIME_BRANCH:
117
- Currently only used with git-based testing. This must correspond to a branch in the
118
- puppet-agent repo. We use it to determine the tag of the agent-runtime package that
119
- we want. We also use it to construct the agent-runtime archive name (ie agent-runtime-${branch}-${tag})
116
+ RUNTIME_BRANCH:
117
+ Currently only used with git-based testing. This must correspond to a branch in the
118
+ puppet-agent repo. We use it to determine the tag of the agent-runtime package that
119
+ we want. We also use it to construct the agent-runtime archive name (ie agent-runtime-${branch}-${tag})
120
120
  EOS
121
121
 
122
122
  namespace :ci do
123
- desc "Print usage information"
123
+ desc 'Print usage information'
124
124
  task :help do
125
125
  puts USAGE
126
126
  exit 1
127
127
  end
128
128
 
129
129
  task :check_env do
130
- sha = ENV['SHA']
130
+ sha = ENV.fetch('SHA', nil)
131
131
  case sha
132
132
  when /^\d+\.\d+\.\d+$/
133
133
  # tags are ok
134
134
  when /^[0-9a-f]{40}$/
135
135
  # full SHAs are ok
136
136
  when nil
137
- puts "Error: A SHA must be specified"
137
+ puts 'Error: A SHA must be specified'
138
138
  puts "\n"
139
139
  puts USAGE
140
140
  exit 1
@@ -146,7 +146,7 @@ namespace :ci do
146
146
  end
147
147
 
148
148
  if ENV['TESTS'].nil?
149
- ENV['TESTS'] ||= ENV['TEST']
149
+ ENV['TESTS'] ||= ENV.fetch('TEST', nil)
150
150
  ENV['TESTS'] ||= 'tests'
151
151
  end
152
152
  end
@@ -160,28 +160,24 @@ namespace :ci do
160
160
  elsif env_config = ENV['CONFIG']
161
161
  puts 'Warning: environment variable CONFIG deprecated. Please use HOSTS to match beaker options.'
162
162
  env_config
163
- else
163
+ elsif agent_target = ENV['TEST_TARGET']
164
164
  # By default we assume TEST_TARGET is an agent-only string
165
- if agent_target = ENV['TEST_TARGET']
166
- master_target = ENV['MASTER_TEST_TARGET'] || DEFAULT_MASTER_TEST_TARGET
167
- "#{master_target}-#{agent_target}"
168
- else
169
- DEFAULT_TEST_TARGETS
170
- end
165
+ master_target = ENV['MASTER_TEST_TARGET'] || DEFAULT_MASTER_TEST_TARGET
166
+ "#{master_target}-#{agent_target}"
167
+ else
168
+ DEFAULT_TEST_TARGETS
171
169
  end
172
170
 
173
- if File.exists?(hosts)
171
+ if File.exist?(hosts)
174
172
  ENV['HOSTS'] = hosts
175
173
  else
176
174
  hosts_file = "tmp/#{hosts}-#{SecureRandom.uuid}.yaml"
177
175
  cli_args = [
178
176
  hosts,
179
177
  '--disable-default-role',
180
- '--osinfo-version', '1'
178
+ '--osinfo-version', '1',
181
179
  ]
182
- if args[:hypervisor]
183
- cli_args += ['--hypervisor', args[:hypervisor]]
184
- end
180
+ cli_args += ['--hypervisor', args[:hypervisor]] if args[:hypervisor]
185
181
  cli = BeakerHostGenerator::CLI.new(cli_args)
186
182
  FileUtils.mkdir_p('tmp') # -p ignores when dir already exists
187
183
  File.open(hosts_file, 'w') do |fh|
@@ -192,22 +188,22 @@ namespace :ci do
192
188
  end
193
189
 
194
190
  namespace :test do
195
- desc <<-EOS
196
- Run the acceptance tests using puppet-agent (AIO) packages, with or without
197
- retrying failed tests one time.
191
+ desc <<~EOS
192
+ Run the acceptance tests using puppet-agent (AIO) packages, with or without
193
+ retrying failed tests one time.
198
194
 
199
- $ SHA=<full sha> bundle exec rake ci:test:aio
195
+ $ SHA=<full sha> bundle exec rake ci:test:aio
200
196
 
201
- or
197
+ or
202
198
 
203
- $ SHA=<full sha> bundle exec rake ci:test:aio[RETRIES]
199
+ $ SHA=<full sha> bundle exec rake ci:test:aio[RETRIES]
204
200
 
205
201
 
206
- SHA should be the full SHA for the puppet-agent package.
202
+ SHA should be the full SHA for the puppet-agent package.
207
203
 
208
- RETRIES should be set to true to retry failed tests one time. It defaults
209
- to false.
210
- EOS
204
+ RETRIES should be set to true to retry failed tests one time. It defaults
205
+ to false.
206
+ EOS
211
207
  task :aio, [:retries] => ['ci:check_env', 'ci:gen_hosts'] do |t, args|
212
208
  args.with_defaults(retries: false)
213
209
  if args[:retries]
@@ -217,23 +213,23 @@ EOS
217
213
  end
218
214
  end
219
215
 
220
- desc <<-EOS
221
- Setup acceptance tests using puppet-agent (AIO) packages.
216
+ desc <<~EOS
217
+ Setup acceptance tests using puppet-agent (AIO) packages.
222
218
 
223
- $ SHA=<tag or full sha> HOSTS=<hosts> bundle exec rake ci:test:setup
219
+ $ SHA=<tag or full sha> HOSTS=<hosts> bundle exec rake ci:test:setup
224
220
 
225
- SHA should be the tag or full SHA for the puppet-agent package.
221
+ SHA should be the tag or full SHA for the puppet-agent package.
226
222
 
227
- HOSTS can be a beaker-hostgenerator string or existing file.
228
- EOS
229
- task :setup => ['ci:check_env'] do |t, args|
223
+ HOSTS can be a beaker-hostgenerator string or existing file.
224
+ EOS
225
+ task setup: ['ci:check_env'] do |t, args|
230
226
  unless ENV['HOSTS']
231
- case File.basename(Dir.pwd.sub(/\/acceptance$/, ''))
232
- when 'pxp-agent', 'puppet'
233
- ENV['HOSTS'] ||= 'redhat7-64m-redhat7-64a'
234
- else
235
- ENV['HOSTS'] ||= 'redhat7-64a'
236
- end
227
+ ENV['HOSTS'] ||= case File.basename(Dir.pwd.sub(%r{/acceptance$}, ''))
228
+ when 'pxp-agent', 'puppet'
229
+ 'redhat7-64m-redhat7-64a'
230
+ else
231
+ 'redhat7-64a'
232
+ end
237
233
  end
238
234
 
239
235
  Rake::Task[:'ci:gen_hosts'].invoke('abs')
@@ -246,15 +242,15 @@ EOS
246
242
  puts "\nRun 'bundle exec beaker exec <path>' where <path> is a directory or comma-separated list of tests."
247
243
  end
248
244
 
249
- desc <<-EOS
250
- Run the acceptance tests against puppet gem on various platforms, performing a
251
- basic smoke test.
245
+ desc <<~EOS
246
+ Run the acceptance tests against puppet gem on various platforms, performing a
247
+ basic smoke test.
252
248
 
253
- $ SHA=<full sha> bundle exec rake:ci:gem
249
+ $ SHA=<full sha> bundle exec rake:ci:gem
254
250
 
255
- SHA should be the full SHA for the component.
256
- EOS
257
- task :gem => ['ci:check_env'] do
251
+ SHA should be the full SHA for the component.
252
+ EOS
253
+ task gem: ['ci:check_env'] do
258
254
  beaker(:init, '--hosts', 'config/nodes/gem.yaml', '--options-file', 'config/gem/options.rb')
259
255
  beaker(:provision)
260
256
  begin
@@ -266,28 +262,28 @@ EOS
266
262
  end
267
263
  end
268
264
 
269
- desc <<-EOS
270
- Run the acceptance tests against a git checkout.
265
+ desc <<~EOS
266
+ Run the acceptance tests against a git checkout.
271
267
 
272
- $ SHA=<full sha> bundle exec rake ci:test:git
268
+ $ SHA=<full sha> bundle exec rake ci:test:git
273
269
 
274
- SHA: for git based testing specifically, this can be a sha, a branch, or a tag.
270
+ SHA: for git based testing specifically, this can be a sha, a branch, or a tag.
275
271
 
276
- FORK: to test against your fork, defaults to 'puppetlabs'
272
+ FORK: to test against your fork, defaults to 'puppetlabs'
277
273
 
278
- SERVER: to git fetch from an alternate GIT server, defaults to 'github.com'
274
+ SERVER: to git fetch from an alternate GIT server, defaults to 'github.com'
279
275
 
280
- RUNTIME_BRANCH: the branch of the agent-runtime package to grab, defaults to
281
- 'master'. This tells us which branch of puppet-agent to get the runtime tag
282
- from and helps us create the archive name when we go to curl it down.
283
- EOS
284
- task :git => ['ci:check_env', 'ci:gen_hosts'] do
276
+ RUNTIME_BRANCH: the branch of the agent-runtime package to grab, defaults to
277
+ 'master'. This tells us which branch of puppet-agent to get the runtime tag
278
+ from and helps us create the archive name when we go to curl it down.
279
+ EOS
280
+ task git: ['ci:check_env', 'ci:gen_hosts'] do
285
281
  beaker_suite(:git)
286
282
  end
287
283
  end
288
284
 
289
- task :test_and_preserve_hosts => ['ci:check_env', 'ci:gen_hosts'] do
290
- puts "WARNING, the test_and_preserve_hosts task is deprecated, use ci:test:aio instead."
285
+ task test_and_preserve_hosts: ['ci:check_env', 'ci:gen_hosts'] do
286
+ puts 'WARNING, the test_and_preserve_hosts task is deprecated, use ci:test:aio instead.'
291
287
  Rake::Task['ci:test:aio'].execute
292
288
  end
293
289
  end
@@ -307,20 +303,21 @@ def beaker(command, *argv)
307
303
  end
308
304
 
309
305
  def beaker_setup(type)
310
- beaker(:init, '--hosts', ENV['HOSTS'], '--preserve-hosts', 'always', '--options-file', "config/#{String(type)}/options.rb")
306
+ beaker(:init, '--hosts', ENV.fetch('HOSTS', nil), '--preserve-hosts', 'always', '--options-file',
307
+ "config/#{String(type)}/options.rb")
311
308
  beaker(:provision)
312
309
  beaker(:exec, 'pre-suite', '--preserve-state', '--pre-suite', pre_suites(type))
313
310
  beaker(:exec, 'pre-suite', '--preserve-state')
314
311
  end
315
312
 
316
313
  def beaker_suite(type)
317
- beaker(:init, '--hosts', ENV['HOSTS'], '--options-file', "config/#{String(type)}/options.rb")
314
+ beaker(:init, '--hosts', ENV.fetch('HOSTS', nil), '--options-file', "config/#{String(type)}/options.rb")
318
315
  beaker(:provision)
319
316
 
320
317
  begin
321
318
  beaker(:exec, 'pre-suite', '--preserve-state', '--pre-suite', pre_suites(type))
322
319
  beaker(:exec, 'pre-suite', '--preserve-state')
323
- beaker(:exec, ENV['TESTS'])
320
+ beaker(:exec, ENV.fetch('TESTS', nil))
324
321
  beaker(:exec, 'post-suite')
325
322
  ensure
326
323
  preserve_hosts = ENV['OPTIONS'].include?('--preserve-hosts=always') if ENV['OPTIONS']
@@ -329,7 +326,7 @@ def beaker_suite(type)
329
326
  end
330
327
 
331
328
  def beaker_suite_retry(type)
332
- beaker(:init, '--hosts', ENV['HOSTS'], '--options-file', "config/#{String(type)}/options.rb")
329
+ beaker(:init, '--hosts', ENV.fetch('HOSTS', nil), '--options-file', "config/#{String(type)}/options.rb")
333
330
  beaker(:provision)
334
331
 
335
332
  begin
@@ -338,17 +335,15 @@ def beaker_suite_retry(type)
338
335
 
339
336
  begin
340
337
  json_results_file = Tempfile.new
341
- beaker(:exec, ENV['TESTS'], '--test-results-file', json_results_file.path)
338
+ beaker(:exec, ENV.fetch('TESTS', nil), '--test-results-file', json_results_file.path)
342
339
  rescue RuntimeError => e
343
340
  puts "ERROR: #{e.message}"
344
341
  tests_to_rerun = JSON.load(File.read(json_results_file.path))
345
- if tests_to_rerun.nil? || tests_to_rerun.empty?
346
- raise e
347
- else
348
- puts '*** Retrying the following:'
349
- puts tests_to_rerun.map { |spec| " #{spec}" }
350
- beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(',') )
351
- end
342
+ raise e if tests_to_rerun.nil? || tests_to_rerun.empty?
343
+
344
+ puts '*** Retrying the following:'
345
+ puts tests_to_rerun.map { |spec| " #{spec}" }
346
+ beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(','))
352
347
  end
353
348
  ensure
354
349
  beaker(:exec, 'post-suite')
@@ -361,40 +356,37 @@ def pre_suites(type)
361
356
  beaker_root = Pathname.new(File.dirname(__dir__)).relative_path_from(Pathname.new(Dir.pwd))
362
357
 
363
358
  presuites = case type
364
- when :aio
365
- [
366
- "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
367
- "#{beaker_root}/setup/common/003_solaris_cert_fix.rb",
368
- "#{beaker_root}/setup/common/005_redhat_subscription_fix.rb",
369
- "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
370
- "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
371
- "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
372
- "#{beaker_root}/setup/common/020_InstallCumulusModules.rb",
373
- "#{beaker_root}/setup/common/021_InstallAristaModuleMasters.rb",
374
- "#{beaker_root}/setup/common/022_InstallAristaModuleAgents.rb",
375
- "#{beaker_root}/setup/common/025_StopFirewall.rb",
376
- "#{beaker_root}/setup/common/030_StopSssd.rb",
377
- "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
378
- "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
379
- ]
380
- when :gem
381
- [
382
- "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
383
- "#{beaker_root}/setup/git/000_EnvSetup.rb",
384
- ]
385
- when :git
386
- [
387
- "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
388
- "#{beaker_root}/setup/git/000_EnvSetup.rb",
389
- "#{beaker_root}/setup/git/010_TestSetup.rb",
390
- "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
391
- "#{beaker_root}/setup/git/020_PuppetUserAndGroup.rb",
392
- "#{beaker_root}/setup/git/070_InstallCACerts.rb",
393
- "#{beaker_root}/setup/common/025_StopFirewall.rb",
394
- "#{beaker_root}/setup/common/030_StopSssd.rb",
395
- "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
396
- "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
397
- ]
398
- end
359
+ when :aio
360
+ [
361
+ "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
362
+ "#{beaker_root}/setup/common/003_solaris_cert_fix.rb",
363
+ "#{beaker_root}/setup/common/005_redhat_subscription_fix.rb",
364
+ "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
365
+ "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
366
+ "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
367
+ "#{beaker_root}/setup/common/025_StopFirewall.rb",
368
+ "#{beaker_root}/setup/common/030_StopSssd.rb",
369
+ "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
370
+ "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
371
+ ]
372
+ when :gem
373
+ [
374
+ "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
375
+ "#{beaker_root}/setup/git/000_EnvSetup.rb",
376
+ ]
377
+ when :git
378
+ [
379
+ "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
380
+ "#{beaker_root}/setup/git/000_EnvSetup.rb",
381
+ "#{beaker_root}/setup/git/010_TestSetup.rb",
382
+ "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
383
+ "#{beaker_root}/setup/git/020_PuppetUserAndGroup.rb",
384
+ "#{beaker_root}/setup/git/070_InstallCACerts.rb",
385
+ "#{beaker_root}/setup/common/025_StopFirewall.rb",
386
+ "#{beaker_root}/setup/common/030_StopSssd.rb",
387
+ "#{beaker_root}/setup/common/040_ValidateSignCert.rb",
388
+ "#{beaker_root}/setup/common/045_EnsureMasterStarted.rb",
389
+ ]
390
+ end
399
391
  presuites.join(',')
400
392
  end