puppet_litmus 0.34.0 → 0.34.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/puppet_litmus/rake_tasks.rb +88 -83
- data/lib/puppet_litmus/version.rb +1 -1
- metadata +6 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec60ae7ab88bc74fccfa22c04a83a89fbabaeab56885811babafcc33ec7aa122
|
4
|
+
data.tar.gz: b60bab49299dec0ec5e6652c4535baf63196cb896680aa637eba98204ea4ac73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79d7c7fd85e94e2e040ca489bae950a2385fc30b7986a3800fc25b4bc29c0d3fb0f1b46b5bb9d02b5d86234dd52ae5cf0a9d79ea60e734d854848a29fa485be9
|
7
|
+
data.tar.gz: 2b67b3847d438a69c6a6518684365ad135b3c59a74ff3227de30dd6d9544a5e124a43855d52e4b88974d09652ae11bae8884e871431eec605e76decf257e50d0
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ In order to use this new functionality just simply run:
|
|
48
48
|
|
49
49
|
## Documentation
|
50
50
|
|
51
|
-
For documentation, see our [Litmus Docs Site](https://puppetlabs.github.io/litmus/).
|
51
|
+
For documentation, see our [Litmus Docs Site](https://puppetlabs.github.io/content-and-tooling-team/docs/litmus/).
|
52
52
|
|
53
53
|
## Other Resources
|
54
54
|
|
@@ -336,104 +336,109 @@ namespace :litmus do
|
|
336
336
|
|
337
337
|
namespace :acceptance do
|
338
338
|
require 'rspec/core/rake_task'
|
339
|
-
|
339
|
+
|
340
|
+
# Run acceptance tests against all machines in the inventory file in parallel.
|
341
|
+
desc 'Run tests in parallel against all machines in the inventory file'
|
342
|
+
task :parallel, [:tag] do |_task, args|
|
343
|
+
args.with_defaults(tag: nil)
|
344
|
+
|
340
345
|
inventory_hash = inventory_hash_from_inventory_file
|
341
346
|
targets = find_targets(inventory_hash, nil)
|
342
347
|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
},
|
365
|
-
}
|
366
|
-
payloads << [title, test, options]
|
367
|
-
end
|
348
|
+
if targets.empty?
|
349
|
+
puts 'No targets found'
|
350
|
+
exit 0
|
351
|
+
end
|
352
|
+
tag_value = if args[:tag].nil?
|
353
|
+
nil
|
354
|
+
else
|
355
|
+
"--tag #{args[:tag]}"
|
356
|
+
end
|
357
|
+
payloads = []
|
358
|
+
# Generate list of targets to provision
|
359
|
+
targets.each do |target|
|
360
|
+
test = "bundle exec rspec ./spec/acceptance #{tag_value} --format progress --require rspec_honeycomb_formatter --format RSpecHoneycombFormatter"
|
361
|
+
title = "#{target}, #{facts_from_node(inventory_hash, target)['platform']}"
|
362
|
+
options = {
|
363
|
+
env: {
|
364
|
+
'TARGET_HOST' => target,
|
365
|
+
},
|
366
|
+
}
|
367
|
+
payloads << [title, test, options]
|
368
|
+
end
|
368
369
|
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
end
|
370
|
+
results = []
|
371
|
+
success_list = []
|
372
|
+
failure_list = []
|
373
|
+
# Provision targets depending on what environment we're in
|
374
|
+
if ENV['CI'] == 'true'
|
375
|
+
# CI systems are strange beasts, we only output a '.' every wee while to keep the terminal alive.
|
376
|
+
puts "Running against #{targets.size} targets.\n"
|
377
|
+
progress = Thread.new do
|
378
|
+
loop do
|
379
|
+
printf '.'
|
380
|
+
sleep(10)
|
381
381
|
end
|
382
|
+
end
|
382
383
|
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
384
|
+
require 'parallel'
|
385
|
+
results = Parallel.map(payloads) do |title, test, options|
|
386
|
+
# avoid sending the parent process' main span in the sub-processes
|
387
|
+
# https://www.ruby-forum.com/t/at-exit-inherited-across-fork/122473/2
|
388
|
+
at_exit { exit! }
|
388
389
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
390
|
+
env = options[:env].nil? ? {} : options[:env]
|
391
|
+
env['HONEYCOMB_TRACE'] = Honeycomb.current_span.to_trace_header
|
392
|
+
stdout, stderr, status = Open3.capture3(env, test)
|
393
|
+
["\n================\n#{title}\n", stdout, stderr, status]
|
394
|
+
end
|
395
|
+
# because we cannot modify variables inside of Parallel
|
396
|
+
results.each do |result|
|
397
|
+
if result.last.to_i.zero?
|
398
|
+
success_list.push(result.first.scan(%r{.*})[3])
|
399
|
+
else
|
400
|
+
failure_list.push(result.first.scan(%r{.*})[3])
|
393
401
|
end
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
402
|
+
end
|
403
|
+
Thread.kill(progress)
|
404
|
+
else
|
405
|
+
require 'tty-spinner'
|
406
|
+
spinners = TTY::Spinner::Multi.new("[:spinner] Running against #{targets.size} targets.")
|
407
|
+
payloads.each do |title, test, options|
|
408
|
+
env = options[:env].nil? ? {} : options[:env]
|
409
|
+
env['HONEYCOMB_TRACE'] = Honeycomb.current_span.to_trace_header
|
410
|
+
spinners.register("[:spinner] #{title}") do |sp|
|
411
|
+
stdout, stderr, status = Open3.capture3(env, test)
|
412
|
+
if status.to_i.zero?
|
413
|
+
sp.success
|
414
|
+
success_list.push(title)
|
398
415
|
else
|
399
|
-
|
400
|
-
|
401
|
-
end
|
402
|
-
Thread.kill(progress)
|
403
|
-
else
|
404
|
-
require 'tty-spinner'
|
405
|
-
spinners = TTY::Spinner::Multi.new("[:spinner] Running against #{targets.size} targets.")
|
406
|
-
payloads.each do |title, test, options|
|
407
|
-
env = options[:env].nil? ? {} : options[:env]
|
408
|
-
env['HONEYCOMB_TRACE'] = Honeycomb.current_span.to_trace_header
|
409
|
-
spinners.register("[:spinner] #{title}") do |sp|
|
410
|
-
stdout, stderr, status = Open3.capture3(env, test)
|
411
|
-
if status.to_i.zero?
|
412
|
-
sp.success
|
413
|
-
success_list.push(title)
|
414
|
-
else
|
415
|
-
sp.error
|
416
|
-
failure_list.push(title)
|
417
|
-
end
|
418
|
-
results.push(["================\n#{title}\n", stdout, stderr, status])
|
416
|
+
sp.error
|
417
|
+
failure_list.push(title)
|
419
418
|
end
|
419
|
+
results.push(["================\n#{title}\n", stdout, stderr, status])
|
420
420
|
end
|
421
|
-
spinners.auto_spin
|
422
|
-
spinners.success
|
423
|
-
end
|
424
|
-
|
425
|
-
# output test results
|
426
|
-
results.each do |result|
|
427
|
-
puts result
|
428
421
|
end
|
422
|
+
spinners.auto_spin
|
423
|
+
spinners.success
|
424
|
+
end
|
429
425
|
|
430
|
-
|
431
|
-
|
432
|
-
puts
|
433
|
-
Rake::Task['litmus:check_connectivity'].invoke
|
434
|
-
exit 1 if failure_list.any?
|
426
|
+
# output test results
|
427
|
+
results.each do |result|
|
428
|
+
puts result
|
435
429
|
end
|
436
430
|
|
431
|
+
# output test summary
|
432
|
+
puts "Successful on #{success_list.size} nodes: #{success_list}" if success_list.any?
|
433
|
+
puts "Failed on #{failure_list.size} nodes: #{failure_list}" if failure_list.any?
|
434
|
+
Rake::Task['litmus:check_connectivity'].invoke
|
435
|
+
exit 1 if failure_list.any?
|
436
|
+
end
|
437
|
+
|
438
|
+
if File.file?('spec/fixtures/litmus_inventory.yaml')
|
439
|
+
inventory_hash = inventory_hash_from_inventory_file
|
440
|
+
targets = find_targets(inventory_hash, nil)
|
441
|
+
|
437
442
|
targets.each do |target|
|
438
443
|
desc "Run serverspec against #{target}"
|
439
444
|
next if target == 'litmus_localhost'
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_litmus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.34.
|
4
|
+
version: 0.34.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bolt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.1
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: '3.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.1
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: '3.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: puppet-modulebuilder
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|