simp-beaker-helpers 1.34.3 → 1.35.1
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/workflows/pr_acceptance.yml +1 -1
- data/.github/workflows/pr_tests.yml +6 -7
- data/.rubocop.yml +652 -495
- data/CHANGELOG.md +8 -0
- data/Gemfile +5 -2
- data/lib/simp/beaker_helpers/constants.rb +7 -5
- data/lib/simp/beaker_helpers/inspec.rb +52 -55
- data/lib/simp/beaker_helpers/snapshot.rb +126 -134
- data/lib/simp/beaker_helpers/ssg.rb +33 -34
- data/lib/simp/beaker_helpers/version.rb +2 -1
- data/lib/simp/beaker_helpers/windows.rb +4 -1
- data/lib/simp/beaker_helpers.rb +274 -291
- data/lib/simp/rake/beaker.rb +175 -177
- data/spec/acceptance/suites/default/check_puppet_version_spec.rb +3 -3
- data/spec/acceptance/suites/default/fixture_modules_spec.rb +9 -9
- data/spec/acceptance/suites/default/install_simp_deps_repo_spec.rb +7 -13
- data/spec/acceptance/suites/default/pki_tests_spec.rb +10 -16
- data/spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb +4 -4
- data/spec/acceptance/suites/inspec/00_default_spec.rb +22 -22
- data/spec/acceptance/suites/offline/00_default_spec.rb +43 -12
- data/spec/acceptance/suites/offline/nodesets/default.yml +1 -3
- data/spec/acceptance/suites/puppet_collections/00_default_spec.rb +3 -3
- data/spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb +27 -7
- data/spec/acceptance/suites/snapshot/10_general_usage_spec.rb +3 -3
- data/spec/acceptance/suites/ssg/00_default_spec.rb +20 -18
- data/spec/acceptance/suites/windows/00_default_spec.rb +47 -49
- data/spec/acceptance/suites/windows/nodesets/default.yml +3 -3
- data/spec/acceptance/suites/windows/nodesets/win2012.yml +3 -3
- data/spec/acceptance/suites/windows/nodesets/win2016.yml +3 -3
- data/spec/acceptance/suites/windows/nodesets/win2019.yml +3 -3
- data/spec/lib/simp/beaker_helpers_spec.rb +96 -66
- data/spec/spec_helper.rb +51 -53
- data/spec/spec_helper_acceptance.rb +17 -22
- metadata +5 -5
data/lib/simp/rake/beaker.rb
CHANGED
@@ -6,50 +6,53 @@ require 'beaker/tasks/rake_task'
|
|
6
6
|
require 'beaker-rspec/rake_task'
|
7
7
|
require 'puppetlabs_spec_helper/tasks/fixtures'
|
8
8
|
|
9
|
+
# Simp namespace
|
9
10
|
module Simp; end
|
10
|
-
|
11
|
-
|
12
|
-
def initialize(base_dir)
|
11
|
+
# Simp::Rake namespace
|
12
|
+
module Simp::Rake; end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# Rake tasks for SIMP Beaker testing
|
15
|
+
class Simp::Rake::Beaker < ::Rake::TaskLib
|
16
|
+
def initialize(base_dir) # rubocop:disable Lint/MissingSuper
|
17
|
+
@base_dir = base_dir
|
18
|
+
@clean_list = []
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
::CLEAN.include(%(#{@base_dir}/log))
|
21
|
+
::CLEAN.include(%(#{@base_dir}/junit))
|
22
|
+
::CLEAN.include(%(#{@base_dir}/sec_results))
|
23
|
+
::CLEAN.include(%(#{@base_dir}/spec/fixtures/inspec_deps))
|
21
24
|
|
22
|
-
|
25
|
+
yield self if block_given?
|
23
26
|
|
24
|
-
|
27
|
+
::CLEAN.include(@clean_list)
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
namespace :beaker do
|
30
|
+
desc <<-EOM
|
28
31
|
Run a Beaker test against a specific Nodeset
|
29
32
|
* :nodeset - The nodeset against which you wish to run
|
30
33
|
EOM
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
task :run, [:nodeset] do |t, args|
|
35
|
+
raise "You must pass :nodeset to #{t}" unless args[:nodeset]
|
36
|
+
nodeset = args[:nodeset].strip
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
old_stdout = $stdout
|
39
|
+
nodesets = StringIO.new
|
40
|
+
$stdout = nodesets
|
38
41
|
|
39
|
-
|
42
|
+
Rake::Task['beaker_nodes'].invoke
|
40
43
|
|
41
|
-
|
44
|
+
$stdout = old_stdout
|
42
45
|
|
43
|
-
|
46
|
+
nodesets = nodesets.string.split("\n")
|
44
47
|
|
45
|
-
|
48
|
+
raise "Nodeset '#{nodeset}' not found. Valid Nodesets:\n#{nodesets.map { |x| %( * #{x}) }.join(%(\n))}" unless nodesets.include?(nodeset)
|
46
49
|
|
47
|
-
|
50
|
+
ENV['BEAKER_set'] = nodeset
|
48
51
|
|
49
|
-
|
50
|
-
|
52
|
+
Rake::Task['beaker'].invoke
|
53
|
+
end
|
51
54
|
|
52
|
-
|
55
|
+
desc <<-EOM
|
53
56
|
Run Beaker test suites.
|
54
57
|
* :suite - A specific suite to run
|
55
58
|
* If you set this to `ALL`, all suites will be run
|
@@ -108,211 +111,206 @@ module Simp::Rake
|
|
108
111
|
'default_run' : <true|false> => Default: false
|
109
112
|
```
|
110
113
|
EOM
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
+
task :suites, [:suite, :nodeset] => ['spec_prep'] do |_t, args|
|
115
|
+
suite = args[:suite]
|
116
|
+
nodeset = args[:nodeset]
|
114
117
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
+
# Record Tasks That Fail
|
119
|
+
# Need to figure out how to capture the errors
|
120
|
+
failures = {}
|
118
121
|
|
119
|
-
|
122
|
+
suite_basedir = File.join(@base_dir, 'spec/acceptance/suites')
|
120
123
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
+
if ENV['BEAKER_suite_basedir']
|
125
|
+
suite_basedir = ENV['BEAKER_suite_basedir']
|
126
|
+
end
|
124
127
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
end
|
128
|
+
raise("Error: Suites Directory at '#{suite_basedir}'!") unless File.directory?(suite_basedir)
|
129
|
+
|
130
|
+
if suite && (suite != 'ALL')
|
131
|
+
unless File.directory?(File.join(suite_basedir, suite))
|
132
|
+
STDERR.puts("Error: Could not find suite '#{suite}'")
|
133
|
+
STDERR.puts('Available Suites:')
|
134
|
+
STDERR.puts(' * ' + Dir.glob(
|
135
|
+
File.join(suite_basedir, '*'),
|
136
|
+
).sort.map { |x|
|
137
|
+
File.basename(x)
|
138
|
+
}.join("\n * "))
|
139
|
+
exit(1)
|
138
140
|
end
|
141
|
+
end
|
139
142
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
143
|
+
suite_config = {
|
144
|
+
'fail_fast' => true
|
145
|
+
}
|
146
|
+
suite_config_metadata_path = File.join(suite_basedir, 'config.yml')
|
147
|
+
if File.file?(suite_config_metadata_path)
|
148
|
+
suite_config.merge!(YAML.load_file(suite_config_metadata_path))
|
149
|
+
end
|
147
150
|
|
148
|
-
|
151
|
+
suites = {}
|
149
152
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
153
|
+
if suite && (suite != 'ALL')
|
154
|
+
suites[suite] = {}
|
155
|
+
# If a suite was set, make sure it runs.
|
156
|
+
suites[suite]['default_run'] = true
|
157
|
+
else
|
158
|
+
Dir.glob(File.join(suite_basedir, '*')) do |file|
|
159
|
+
if File.directory?(file)
|
160
|
+
suites[File.basename(file)] = {}
|
158
161
|
|
159
|
-
|
160
|
-
|
161
|
-
end
|
162
|
+
if suite == 'ALL'
|
163
|
+
suites[File.basename(file)]['default_run'] = true
|
162
164
|
end
|
163
165
|
end
|
164
166
|
end
|
167
|
+
end
|
165
168
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
+
suites.each_key do |ste|
|
170
|
+
suites[ste]['name'] = ste
|
171
|
+
suites[ste]['path'] = File.join(suite_basedir, ste)
|
169
172
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
173
|
+
metadata_path = File.join(suites[ste]['path'], 'metadata.yml')
|
174
|
+
if File.file?(metadata_path)
|
175
|
+
suites[ste]['metadata'] = YAML.load_file(metadata_path)
|
176
|
+
end
|
174
177
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
178
|
+
unless File.directory?(File.join(suites[ste]['path'], 'nodesets'))
|
179
|
+
Dir.chdir(suites[ste]['path']) do
|
180
|
+
if File.directory?('../../nodesets')
|
181
|
+
FileUtils.ln_s('../../nodesets', 'nodesets')
|
180
182
|
end
|
181
183
|
end
|
184
|
+
end
|
182
185
|
|
183
|
-
|
186
|
+
suites[ste].merge!(suites[ste]['metadata']) if suites[ste]['metadata']
|
184
187
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
190
|
-
end
|
188
|
+
# Ensure that the 'default' suite runs unless explicitly disabled.
|
189
|
+
next unless suites['default']
|
190
|
+
if suites['default']['default_run'].nil? || (suites['default']['default_run'] == true)
|
191
|
+
suites['default']['default_run'] = true
|
191
192
|
end
|
193
|
+
end
|
192
194
|
|
193
|
-
|
194
|
-
|
195
|
-
# Need to ensure that 'default' is first
|
196
|
-
ordered_suites = suites.keys.sort
|
197
|
-
default_suite = ordered_suites.delete('default')
|
198
|
-
ordered_suites.unshift(default_suite) if default_suite
|
195
|
+
raise("Error: No Suites Found in '#{suite_basedir}'!") if suites.empty?
|
199
196
|
|
200
|
-
|
201
|
-
|
197
|
+
# Need to ensure that 'default' is first
|
198
|
+
ordered_suites = suites.keys.sort
|
199
|
+
default_suite = ordered_suites.delete('default')
|
200
|
+
ordered_suites.unshift(default_suite) if default_suite
|
202
201
|
|
203
|
-
|
202
|
+
suite_start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
203
|
+
ordered_suites.each do |ste|
|
204
|
+
next unless suites[ste]['default_run'] == true
|
204
205
|
|
205
|
-
|
206
|
+
name = suites[ste]['name']
|
206
207
|
|
207
|
-
|
208
|
+
$stdout.puts("\n\n=== Suite '#{name}' Starting ===\n\n")
|
208
209
|
|
209
|
-
|
210
|
-
|
210
|
+
nodesets = []
|
211
|
+
nodeset_path = File.join(suites[ste]['path'], 'nodesets')
|
211
212
|
|
212
|
-
|
213
|
-
|
214
|
-
|
213
|
+
if nodeset
|
214
|
+
if nodeset == 'ALL'
|
215
|
+
nodesets = Dir.glob(File.join(nodeset_path, '*.yml'))
|
215
216
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
else
|
220
|
-
nodeset.split(':').each do |tgt_nodeset|
|
221
|
-
nodesets << File.join(nodeset_path, "#{tgt_nodeset.strip}.yml")
|
222
|
-
end
|
223
|
-
end
|
217
|
+
# Make sure we run the default set first
|
218
|
+
default_set = nodesets.delete(File.join(nodeset_path, 'default.yml'))
|
219
|
+
nodesets.unshift(default_set) if default_set
|
224
220
|
else
|
225
|
-
|
221
|
+
nodeset.split(':').each do |tgt_nodeset|
|
222
|
+
nodesets << File.join(nodeset_path, "#{tgt_nodeset.strip}.yml")
|
223
|
+
end
|
226
224
|
end
|
225
|
+
else
|
226
|
+
nodesets << File.join(nodeset_path, 'default.yml')
|
227
|
+
end
|
227
228
|
|
228
|
-
|
229
|
-
|
230
|
-
nodesets.each do |nodeset_yml|
|
231
|
-
parsed_nodeset = ::Beaker::Options::HostsFileParser.parse_hosts_file(nodeset_yml)
|
229
|
+
refined_nodesets = []
|
232
230
|
|
233
|
-
|
234
|
-
|
231
|
+
nodesets.each do |nodeset_yml|
|
232
|
+
parsed_nodeset = ::Beaker::Options::HostsFileParser.parse_hosts_file(nodeset_yml)
|
235
233
|
|
236
|
-
|
237
|
-
|
238
|
-
else
|
239
|
-
parsed_nodeset_hosts = parsed_nodeset.delete(:HOSTS)
|
234
|
+
# Default to multi-node testing for backwards compatibility
|
235
|
+
multi_node = ((parsed_nodeset[:multi_node] == false) ? false : true)
|
240
236
|
|
241
|
-
|
237
|
+
if multi_node
|
238
|
+
refined_nodesets.push(nodeset_yml)
|
239
|
+
else
|
240
|
+
parsed_nodeset_hosts = parsed_nodeset.delete(:HOSTS)
|
242
241
|
|
243
|
-
|
244
|
-
|
242
|
+
parsed_nodeset_hosts.each do |k, v|
|
243
|
+
v[:roles] ||= []
|
244
|
+
v[:roles] |= ['default']
|
245
245
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
246
|
+
tmp_nodeset = {
|
247
|
+
HOSTS: { k => v },
|
248
|
+
CONFIG: parsed_nodeset
|
249
|
+
}
|
250
250
|
|
251
|
-
|
252
|
-
|
253
|
-
|
251
|
+
tmp_nodeset_file = Tempfile.new("nodeset_#{k}-")
|
252
|
+
tmp_nodeset_file.write(tmp_nodeset.to_yaml)
|
253
|
+
tmp_nodeset_file.close
|
254
254
|
|
255
|
-
|
255
|
+
refined_nodesets.push(tmp_nodeset_file.path)
|
256
256
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
end
|
257
|
+
at_exit do
|
258
|
+
if tmp_nodeset_file && File.exist?(tmp_nodeset_file.path)
|
259
|
+
tmp_nodeset_file.close
|
260
|
+
tmp_nodeset_file.unlink
|
262
261
|
end
|
263
262
|
end
|
264
263
|
end
|
265
264
|
end
|
265
|
+
end
|
266
266
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
fail("*** Suite #{name} Nodeset '#{File.basename(nodeset_yml, '.yml')}' Not Found ***")
|
273
|
-
else
|
274
|
-
$stdout.puts("=== Suite #{name} Nodeset '#{File.basename(nodeset_yml, '.yml')}' Not Found, Skipping ===")
|
275
|
-
next
|
276
|
-
end
|
277
|
-
end
|
267
|
+
refined_nodesets.sort.each do |nodeset_yml|
|
268
|
+
unless File.file?(nodeset_yml)
|
269
|
+
# Get here if user has specified a non-existent nodeset or the
|
270
|
+
# implied `default` nodeset does not exist.
|
271
|
+
raise("*** Suite #{name} Nodeset '#{File.basename(nodeset_yml, '.yml')}' Not Found ***") if suite_config['fail_fast']
|
278
272
|
|
279
|
-
|
273
|
+
$stdout.puts("=== Suite #{name} Nodeset '#{File.basename(nodeset_yml, '.yml')}' Not Found, Skipping ===")
|
274
|
+
next
|
280
275
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
tsk.pattern = File.join(suites[ste]['path'])
|
285
|
-
end
|
276
|
+
end
|
277
|
+
|
278
|
+
ENV['BEAKER_setfile'] = nodeset_yml
|
286
279
|
|
287
|
-
|
280
|
+
Rake::Task[:beaker].clear
|
281
|
+
RSpec::Core::RakeTask.new(:beaker) do |tsk|
|
282
|
+
tsk.rspec_opts = ['--color']
|
283
|
+
tsk.pattern = File.join(suites[ste]['path'])
|
284
|
+
end
|
288
285
|
|
289
|
-
|
286
|
+
current_suite_task = Rake::Task[:beaker]
|
287
|
+
|
288
|
+
if suite_config['fail_fast'] == true
|
289
|
+
current_suite_task.execute
|
290
|
+
else
|
291
|
+
begin
|
290
292
|
current_suite_task.execute
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
'path' => suites[ste]['path'],
|
297
|
-
'nodeset' => File.basename(nodeset_yml, '.yml')
|
298
|
-
}
|
299
|
-
end
|
293
|
+
rescue SystemExit
|
294
|
+
failures[suites[ste]['name']] = {
|
295
|
+
'path' => suites[ste]['path'],
|
296
|
+
'nodeset' => File.basename(nodeset_yml, '.yml')
|
297
|
+
}
|
300
298
|
end
|
301
|
-
|
302
|
-
$stdout.puts("\n\n=== Suite '#{name}' Complete ===\n\n")
|
303
299
|
end
|
300
|
+
|
301
|
+
$stdout.puts("\n\n=== Suite '#{name}' Complete ===\n\n")
|
304
302
|
end
|
305
|
-
|
303
|
+
end
|
304
|
+
suite_end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
306
305
|
|
307
|
-
|
306
|
+
suite_run_time = ((suite_end_time - suite_start_time) / 60).round(2)
|
308
307
|
|
309
|
-
|
308
|
+
$stdout.puts("== Total Runtime: #{suite_run_time} minutes ==\n\n")
|
310
309
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
end
|
310
|
+
unless failures.keys.empty?
|
311
|
+
$stdout.puts('The following tests had failures:')
|
312
|
+
failures.keys.sort.each do |ste|
|
313
|
+
$stdout.puts(" * #{ste} => #{failures[ste]['path']} on #{failures[ste]['nodeset']}")
|
316
314
|
end
|
317
315
|
end
|
318
316
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper_acceptance'
|
2
2
|
|
3
3
|
unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
|
4
|
-
|
4
|
+
raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
|
5
5
|
end
|
6
6
|
|
7
7
|
if ENV['BEAKER_PUPPET_COLLECTION']
|
8
|
-
target_version = ENV['BEAKER_PUPPET_COLLECTION'][
|
8
|
+
target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
|
9
9
|
elsif ENV['PUPPET_VERSION']
|
10
10
|
target_version = ENV['PUPPET_VERSION'].split('.').first
|
11
11
|
end
|
@@ -15,7 +15,7 @@ hosts.each do |host|
|
|
15
15
|
context "on #{host}" do
|
16
16
|
client_puppet_version = on(host, 'puppet --version').output.lines.last.strip
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "is running puppet version #{target_version}" do
|
19
19
|
expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
|
20
20
|
end
|
21
21
|
end
|
@@ -3,29 +3,29 @@ require 'spec_helper_acceptance'
|
|
3
3
|
context 'after copy_fixture_modules_to( hosts )' do
|
4
4
|
before(:all) do
|
5
5
|
# This should automatically run pluginsync_on hosts
|
6
|
-
copy_fixture_modules_to(
|
6
|
+
copy_fixture_modules_to(hosts)
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "fact_on(default,'root_home')" do
|
10
|
-
it '
|
10
|
+
it 'does not return value of `root_home`' do
|
11
11
|
expect(fact_on(default, 'root_home').to_s).to eq ''
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "pfact_on(default,'root_home')" do
|
16
|
-
it '
|
16
|
+
it 'returns value of `root_home`' do
|
17
17
|
expect(pfact_on(default, 'root_home')).to eq '/root'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "pfact_on(default,'os.release.major')" do
|
22
|
-
it '
|
23
|
-
expect(pfact_on(default, 'os.release.major')).to match(
|
22
|
+
it 'returns the value of `os.release.major`' do
|
23
|
+
expect(pfact_on(default, 'os.release.major')).to match(%r{.+})
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "pfact_on(default,'os.release.foo')" do
|
28
|
-
it '
|
28
|
+
it 'does not return the value of `os.release.foo`' do
|
29
29
|
expect(pfact_on(default, 'os.release.foo').to_s).to eq ''
|
30
30
|
end
|
31
31
|
end
|
@@ -33,13 +33,13 @@ context 'after copy_fixture_modules_to( hosts )' do
|
|
33
33
|
describe "pfact_on(default,'fips_enabled')" do
|
34
34
|
expected = (ENV['BEAKER_fips'] == 'yes')
|
35
35
|
|
36
|
-
it '
|
36
|
+
it 'returns false' do
|
37
37
|
expect(pfact_on(default, 'fips_enabled')).to eq expected
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
describe
|
42
|
-
it '
|
41
|
+
describe 'pfact_on returns a hash' do
|
42
|
+
it 'returns a Hash' do
|
43
43
|
expect(pfact_on(default, 'os')).to be_a(Hash)
|
44
44
|
end
|
45
45
|
end
|
@@ -7,7 +7,7 @@ hosts.each do |host|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '#install_simp_repos' do
|
10
|
-
it '
|
10
|
+
it 'installs yum utils' do
|
11
11
|
host.install_package('yum-utils')
|
12
12
|
end
|
13
13
|
|
@@ -15,11 +15,8 @@ hosts.each do |host|
|
|
15
15
|
before(:all) do
|
16
16
|
install_simp_repos(host)
|
17
17
|
rescue => e
|
18
|
-
|
19
|
-
|
20
|
-
else
|
21
|
-
raise e
|
22
|
-
end
|
18
|
+
raise e unless expect_failures
|
19
|
+
warn e.message
|
23
20
|
end
|
24
21
|
|
25
22
|
it 'enables the correct repos' do
|
@@ -43,13 +40,10 @@ hosts.each do |host|
|
|
43
40
|
|
44
41
|
context 'when passed a disabled list ' do
|
45
42
|
before(:all) do
|
46
|
-
install_simp_repos(host, ['simp-community-simp']
|
43
|
+
install_simp_repos(host, ['simp-community-simp'])
|
47
44
|
rescue => e
|
48
|
-
|
49
|
-
|
50
|
-
else
|
51
|
-
raise e
|
52
|
-
end
|
45
|
+
raise e unless expect_failures
|
46
|
+
warn e.message
|
53
47
|
end
|
54
48
|
|
55
49
|
it 'enables the correct repos' do
|
@@ -58,7 +52,7 @@ hosts.each do |host|
|
|
58
52
|
end
|
59
53
|
|
60
54
|
it 'disables the correct repos' do
|
61
|
-
on(host, 'yum -y list simp', :
|
55
|
+
on(host, 'yum -y list simp', acceptable_exit_codes: [1])
|
62
56
|
end
|
63
57
|
end
|
64
58
|
end
|
@@ -1,42 +1,37 @@
|
|
1
1
|
require 'spec_helper_acceptance'
|
2
2
|
require 'tmpdir'
|
3
3
|
|
4
|
-
|
5
4
|
context 'PKI operations' do
|
6
|
-
|
7
5
|
context 'after run_fake_pki_ca_on(default,hosts)' do
|
8
6
|
before(:all) do
|
9
|
-
copy_fixture_modules_to(
|
7
|
+
copy_fixture_modules_to(hosts)
|
10
8
|
end
|
11
9
|
|
12
10
|
shared_examples_for 'a correctly copied keydist/ tree' do |test_dir|
|
13
11
|
it 'correctly copies keydist/ tree' do
|
14
|
-
on(default, "ls -d #{test_dir}"
|
15
|
-
" #{test_dir}/cacerts"
|
16
|
-
" #{test_dir}/cacerts/cacert_*.pem"
|
17
|
-
)
|
12
|
+
on(default, "ls -d #{test_dir}" \
|
13
|
+
" #{test_dir}/cacerts" \
|
14
|
+
" #{test_dir}/cacerts/cacert_*.pem")
|
18
15
|
|
19
16
|
hosts.each do |host|
|
20
17
|
name = host.node_name
|
21
|
-
on(default, "ls -d #{test_dir}/#{name}/cacerts"
|
22
|
-
" #{test_dir}/#{name}/#{name}.pem"
|
23
|
-
" #{test_dir}/#{name}/#{name}.pub"
|
24
|
-
" #{test_dir}/cacerts/cacert_*.pem"
|
25
|
-
)
|
18
|
+
on(default, "ls -d #{test_dir}/#{name}/cacerts" \
|
19
|
+
" #{test_dir}/#{name}/#{name}.pem" \
|
20
|
+
" #{test_dir}/#{name}/#{name}.pub" \
|
21
|
+
" #{test_dir}/cacerts/cacert_*.pem")
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
29
25
|
|
30
26
|
describe 'a Fake CA under /root' do
|
31
27
|
tmp_keydist_dir = Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
|
32
|
-
run_fake_pki_ca_on(
|
28
|
+
run_fake_pki_ca_on(default, hosts, tmp_keydist_dir)
|
33
29
|
|
34
|
-
it '
|
30
|
+
it 'creates /root/pki' do
|
35
31
|
on(default, 'test -d /root/pki')
|
36
32
|
end
|
37
33
|
|
38
34
|
it_behaves_like 'a correctly copied keydist/ tree', '/root/pki/keydist'
|
39
|
-
|
40
35
|
end
|
41
36
|
|
42
37
|
describe 'after copy_keydist_to' do
|
@@ -50,6 +45,5 @@ context 'PKI operations' do
|
|
50
45
|
copy_keydist_to(default, test_dir)
|
51
46
|
it_behaves_like 'a correctly copied keydist/ tree', test_dir
|
52
47
|
end
|
53
|
-
|
54
48
|
end
|
55
49
|
end
|
@@ -25,7 +25,7 @@ new_fixtures['fixtures']['repositories']['augeasproviders_grub'] = 'https://gith
|
|
25
25
|
new_fixtures['fixtures']['repositories']['simplib'] = 'https://github.com/simp/pupmod-simp-simplib'
|
26
26
|
new_fixtures['fixtures']['repositories']['stdlib'] = 'https://github.com/simp/puppetlabs-stdlib'
|
27
27
|
|
28
|
-
File.open(alt_fixtures, 'w'){ |fh| fh.puts(new_fixtures.to_yaml) }
|
28
|
+
File.open(alt_fixtures, 'w') { |fh| fh.puts(new_fixtures.to_yaml) }
|
29
29
|
|
30
30
|
ScrubFixtures.new
|
31
31
|
|
@@ -34,12 +34,12 @@ ENV['FIXTURES_YML'] = alt_fixtures
|
|
34
34
|
|
35
35
|
beaker_gem_options = ENV['BEAKER_GEM_OPTIONS']
|
36
36
|
|
37
|
-
Bundler.with_clean_env
|
37
|
+
Bundler.with_clean_env do
|
38
38
|
ENV['BEAKER_GEM_OPTIONS'] = beaker_gem_options
|
39
39
|
ENV['FIXTURES_YML'] = alt_fixtures
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
`bundle exec rake spec_prep`
|
42
|
+
end
|
43
43
|
|
44
44
|
require 'spec_helper_acceptance'
|
45
45
|
|