simp-beaker-helpers 1.24.4 → 1.26.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tag_deploy_rubygem.yml +7 -3
- data/.gitignore +19 -4
- data/.gitlab-ci.yml +6 -0
- data/CHANGELOG.md +26 -0
- data/Gemfile +2 -2
- data/files/pki/make.sh +3 -2
- data/lib/simp/beaker_helpers/ssg.rb +5 -1
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/lib/simp/beaker_helpers.rb +63 -48
- data/lib/simp/rake/beaker.rb +41 -1
- data/simp-beaker-helpers.gemspec +1 -6
- data/spec/acceptance/nodesets/amzn2.yml +22 -0
- data/spec/acceptance/nodesets/default.yml +3 -3
- data/spec/acceptance/nodesets/docker.yml +1 -1
- data/spec/acceptance/nodesets/oel.yml +1 -2
- data/spec/acceptance/nodesets/ubuntu.yml +2 -1
- data/spec/acceptance/suites/default/fixture_modules_spec.rb +11 -11
- data/spec/acceptance/suites/default/pki_tests_spec.rb +8 -8
- data/spec/acceptance/suites/windows/00_default_spec.rb +0 -2
- data/spec/acceptance/suites/windows/nodesets/default.yml +0 -1
- data/spec/acceptance/suites/windows/nodesets/win2016.yml +0 -1
- data/spec/acceptance/suites/windows/nodesets/win2019.yml +0 -1
- data/spec/spec_helper_acceptance.rb +33 -1
- metadata +5 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a861935f1cb30047688354b52fe5208622c767e05de0637149e6b4042b28d0a
|
4
|
+
data.tar.gz: 834f97957b17b804aad1a9320944c4229b5c2bcd8eccc0f2dd1373b31841f0d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb60e2fa1a182349fa7fcc03e71d7615952400aa6d806d1db0c4b96fdf97a333a8717ddd25b39f61134fba230190c98f707be854be7b5a3edc56fcdb9f4986e9
|
7
|
+
data.tar.gz: '089f9e55f5d55fedd54024c83ef828e05efe9c9e21dc81087abdfb139f748643ab3b836b7eade7649ac348e56b1d3cfb3abfb68252d8a571393054479b3bb4d6'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Create GitHub release, build & publish .gem to rubygems.org on SemVer tag push
|
2
2
|
#
|
3
3
|
# This workflow's jobs are only triggered in repos under the `simp` organization
|
4
4
|
# ------------------------------------------------------------------------------
|
@@ -56,6 +56,10 @@ jobs:
|
|
56
56
|
name: "RELENG checks"
|
57
57
|
if: github.repository_owner == 'simp'
|
58
58
|
runs-on: ubuntu-latest
|
59
|
+
outputs:
|
60
|
+
build_command: ${{ steps.commands.outputs.build_command }}
|
61
|
+
release_command: ${{ steps.commands.outputs.release_command }}
|
62
|
+
pkg_dir: ${{ steps.commands.outputs.pkg_dir }}
|
59
63
|
steps:
|
60
64
|
- name: "Assert '${{ github.ref }}' is a tag"
|
61
65
|
run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
|
@@ -66,8 +70,8 @@ jobs:
|
|
66
70
|
- name: Determine build and release commands
|
67
71
|
id: commands
|
68
72
|
run: |
|
69
|
-
# By default,
|
70
|
-
# To override
|
73
|
+
# By default, this is the standard task from "bundler/gem_tasks"
|
74
|
+
# To override it, add the new command to LOCAL_WORKFLOW_CONFIG_FILE
|
71
75
|
GEM_BUILD_COMMAND='bundle exec rake build'
|
72
76
|
GEM_RELEASE_COMMAND='bundle exec rake build release:rubygem_push'
|
73
77
|
GEM_PKG_DIR='pkg'
|
data/.gitignore
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
+
.*.sw?
|
2
|
+
.yardoc
|
3
|
+
.idea/
|
1
4
|
.fips_fixtures.yml
|
2
5
|
*.gem
|
3
|
-
*.swp
|
4
|
-
Gemfile.lock
|
5
|
-
.bundle/
|
6
6
|
*.old
|
7
7
|
.vagrant
|
8
|
+
dist
|
9
|
+
/pkg
|
10
|
+
# Read everything in fixtures
|
11
|
+
/spec/fixtures/*
|
12
|
+
# Un-ignore hieradata
|
13
|
+
!/spec/fixtures/hieradata/*
|
14
|
+
# Except this one, which is auto-generated
|
15
|
+
/spec/fixtures/hieradata/hiera.yaml
|
16
|
+
/spec/rp_env
|
17
|
+
/.rspec_system
|
18
|
+
/.vagrant
|
19
|
+
/.bundle
|
20
|
+
/.vendor
|
21
|
+
/vendor
|
22
|
+
/junit
|
8
23
|
/log
|
9
|
-
/
|
24
|
+
/doc
|
data/.gitlab-ci.yml
CHANGED
@@ -313,6 +313,12 @@ default:
|
|
313
313
|
script:
|
314
314
|
- bundle exec rake beaker:suites[default]
|
315
315
|
|
316
|
+
default-amzn2:
|
317
|
+
<<: *pup_6_x
|
318
|
+
<<: *acceptance_base
|
319
|
+
script:
|
320
|
+
- bundle exec rake beaker:suites[default,amzn2]
|
321
|
+
|
316
322
|
default-fips:
|
317
323
|
<<: *pup_6_x
|
318
324
|
<<: *acceptance_base
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
### 1.26.2 / 2022-07-26
|
2
|
+
* Fixed:
|
3
|
+
* Limit the length of the CN field of the certificates to 64 bytes
|
4
|
+
|
5
|
+
### 1.26.1 / 2022-06-24
|
6
|
+
* Fixed:
|
7
|
+
* Ensure that `multi_node` is enabled by default for backwards compatibility
|
8
|
+
* Sort the discovered nodesets by default when running with `ALL` nodesets
|
9
|
+
|
10
|
+
### 1.26.0 / 2022-06-24
|
11
|
+
* Added:
|
12
|
+
* Allow for sequential nodesets by setting `multi_node: false` in the
|
13
|
+
`CONFIG:` section of your nodeset.
|
14
|
+
|
15
|
+
### 1.25.0 / 2022-06-11
|
16
|
+
* Fixed:
|
17
|
+
* Replaced calls to `sed -c` with something POSIX compliant that should work
|
18
|
+
on non-RHEL systems
|
19
|
+
* Added:
|
20
|
+
* Updated all dependencies to their latest versions where possible and removed
|
21
|
+
depdendencies on deprecated libraries.
|
22
|
+
|
23
|
+
### 1.24.5 / 2022-05-06
|
24
|
+
* Fixed:
|
25
|
+
* Added a workaround for Amazon Linux 2 testing
|
26
|
+
|
1
27
|
### 1.24.4 / 2022-04-28
|
2
28
|
* Fixed:
|
3
29
|
* Workaround for [MODULES-11315] in `puppet-agent-versions.yaml`
|
data/Gemfile
CHANGED
@@ -44,8 +44,8 @@ group :system_tests do
|
|
44
44
|
gem 'beaker-rspec'
|
45
45
|
gem 'beaker-windows'
|
46
46
|
gem 'net-ssh'
|
47
|
-
gem 'puppet', ENV.fetch('PUPPET_VERSION', '~>
|
48
|
-
gem 'puppetlabs_spec_helper', '~> 3.0'
|
47
|
+
gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 7.0')
|
49
48
|
gem 'rubocop'
|
50
49
|
gem 'rubocop-rspec'
|
50
|
+
gem 'puppetlabs_spec_helper', '~> 4.0'
|
51
51
|
end
|
data/files/pki/make.sh
CHANGED
@@ -46,7 +46,7 @@ for hosts in $*; do
|
|
46
46
|
echo "-- $hname"
|
47
47
|
mkdir -p "${keydist}/${hname}/cacerts"
|
48
48
|
|
49
|
-
sed -e "s/#HOSTNAME#/${hname}/" template_host.cnf > "working/${hname}.cnf"
|
49
|
+
sed -e "s/#HOSTNAME#/${hname:0:63}/" template_host.cnf > "working/${hname}.cnf"
|
50
50
|
|
51
51
|
if [ "$hname" != "$hosts" ];
|
52
52
|
then
|
@@ -73,7 +73,8 @@ for hosts in $*; do
|
|
73
73
|
done
|
74
74
|
done
|
75
75
|
|
76
|
-
|
76
|
+
tgt_file="working/${hname}.cnf"
|
77
|
+
sed -e "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "$tgt_file" 1<> "$tgt_file"
|
77
78
|
fi
|
78
79
|
|
79
80
|
echo "-- running openssl req"
|
@@ -420,7 +420,11 @@ module Simp::BeakerHelpers
|
|
420
420
|
#
|
421
421
|
# This isn't 100% correct but it's "good enough" for an automated CI
|
422
422
|
# environment to tell us if something is critically out of alignment.
|
423
|
-
|
423
|
+
safe_sed(
|
424
|
+
@sut,
|
425
|
+
's/ssg.build_derivatives.profile_handling/__simp_dontcare__ = None #ssg.build_derivatives.profile_handling/g',
|
426
|
+
'scap-content/build-scripts/enable_derivatives.py'
|
427
|
+
)
|
424
428
|
|
425
429
|
on(@sut, %(cd scap-content/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
|
426
430
|
end
|
data/lib/simp/beaker_helpers.rb
CHANGED
@@ -12,6 +12,8 @@ module Simp::BeakerHelpers
|
|
12
12
|
require 'simp/beaker_helpers/ssg'
|
13
13
|
require 'simp/beaker_helpers/version'
|
14
14
|
|
15
|
+
@run_in_parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
16
|
+
|
15
17
|
# Stealing this from the Ruby 2.5 Dir::Tmpname workaround from Rails
|
16
18
|
def self.tmpname
|
17
19
|
t = Time.new.strftime("%Y%m%d")
|
@@ -25,8 +27,7 @@ module Simp::BeakerHelpers
|
|
25
27
|
#
|
26
28
|
# Has no effect if yum or dnf is not present.
|
27
29
|
def set_yum_opt_on(suts, key, value)
|
28
|
-
|
29
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
30
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
30
31
|
repo,target = key.split('.')
|
31
32
|
|
32
33
|
unless target
|
@@ -56,8 +57,7 @@ module Simp::BeakerHelpers
|
|
56
57
|
# 'foo.installonly_limit' => '5' # Applies only to the 'foo' repo
|
57
58
|
# }
|
58
59
|
def set_yum_opts_on(suts, yum_opts={})
|
59
|
-
|
60
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
60
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
61
61
|
yum_opts.each_pair do |k,v|
|
62
62
|
set_yum_opt_on(sut, k, v)
|
63
63
|
end
|
@@ -70,8 +70,7 @@ module Simp::BeakerHelpers
|
|
70
70
|
retry_interval: 10
|
71
71
|
}
|
72
72
|
|
73
|
-
|
74
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
73
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
75
74
|
package_source = package_name unless package_source
|
76
75
|
|
77
76
|
unless sut.check_for_package(package_name)
|
@@ -91,8 +90,7 @@ module Simp::BeakerHelpers
|
|
91
90
|
retry_interval: 10
|
92
91
|
}
|
93
92
|
|
94
|
-
|
95
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
93
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
96
94
|
package_source = package_name unless package_source
|
97
95
|
|
98
96
|
if sut.check_for_package(package_name)
|
@@ -380,8 +378,7 @@ module Simp::BeakerHelpers
|
|
380
378
|
opts[:pluginsync] = opts.fetch(:pluginsync, true)
|
381
379
|
|
382
380
|
unless ENV['BEAKER_copy_fixtures'] == 'no'
|
383
|
-
|
384
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
381
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
385
382
|
STDERR.puts " ** copy_fixture_modules_to: '#{sut}'" if ENV['BEAKER_helpers_verbose']
|
386
383
|
|
387
384
|
# Use spec_prep to provide modules (this supports isolated networks)
|
@@ -443,8 +440,7 @@ module Simp::BeakerHelpers
|
|
443
440
|
end
|
444
441
|
|
445
442
|
def munge_ssh_crypto_policies(suts, key_types=['ssh-rsa'])
|
446
|
-
|
447
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
443
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
448
444
|
if has_crypto_policies(sut)
|
449
445
|
install_latest_package_on(sut, 'crypto-policies', nil, :accept_all_exit_codes => true)
|
450
446
|
|
@@ -455,14 +451,31 @@ module Simp::BeakerHelpers
|
|
455
451
|
end
|
456
452
|
end
|
457
453
|
|
454
|
+
# Perform the equivalend of an in-place sed without changing the target inode
|
455
|
+
#
|
456
|
+
# Required for many container targets
|
457
|
+
def safe_sed(suts = hosts, pattern, target_file)
|
458
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
459
|
+
tmpfile = sut.tmpfile('safe_sed')
|
460
|
+
|
461
|
+
command = [
|
462
|
+
"cp #{target_file} #{tmpfile}",
|
463
|
+
"sed -i '#{pattern}' #{tmpfile}",
|
464
|
+
"cat #{tmpfile} > #{target_file}"
|
465
|
+
].join(' && ')
|
466
|
+
|
467
|
+
on(sut, command)
|
468
|
+
|
469
|
+
sut.rm_rf(tmpfile)
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
458
473
|
# Configure and reboot SUTs into FIPS mode
|
459
474
|
def enable_fips_mode_on( suts = hosts )
|
460
475
|
puts '== configuring FIPS mode on SUTs'
|
461
476
|
puts ' -- (use BEAKER_fips=no to disable)'
|
462
|
-
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
463
477
|
|
464
|
-
|
465
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
478
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
466
479
|
next if sut[:hypervisor] == 'docker'
|
467
480
|
|
468
481
|
if is_windows?(sut)
|
@@ -483,7 +496,7 @@ module Simp::BeakerHelpers
|
|
483
496
|
# that doesn't break vagrant access and is appropriate for
|
484
497
|
# typical module tests.)
|
485
498
|
fips_ssh_ciphers = [ 'aes256-ctr','aes192-ctr','aes128-ctr']
|
486
|
-
|
499
|
+
safe_sed(sut, '/Ciphers /d', '/etc/ssh/sshd_config')
|
487
500
|
on(sut, %(echo 'Ciphers #{fips_ssh_ciphers.join(',')}' >> /etc/ssh/sshd_config))
|
488
501
|
|
489
502
|
fips_enable_modulepath = ''
|
@@ -535,8 +548,7 @@ module Simp::BeakerHelpers
|
|
535
548
|
# - <URL to GPGKEY1>
|
536
549
|
# - <URL to GPGKEY2>
|
537
550
|
def enable_yum_repos_on( suts = hosts )
|
538
|
-
|
539
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
551
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
540
552
|
if sut['yum_repos']
|
541
553
|
sut['yum_repos'].each_pair do |repo, metadata|
|
542
554
|
repo_manifest = create_yum_resource(repo, metadata)
|
@@ -617,8 +629,7 @@ module Simp::BeakerHelpers
|
|
617
629
|
#
|
618
630
|
# Can be disabled by setting BEAKER_enable_epel=no
|
619
631
|
def enable_epel_on(suts)
|
620
|
-
|
621
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
632
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
622
633
|
if ONLINE
|
623
634
|
os_info = fact_on(sut, 'os')
|
624
635
|
os_maj_rel = os_info['release']['major']
|
@@ -661,8 +672,7 @@ module Simp::BeakerHelpers
|
|
661
672
|
end
|
662
673
|
|
663
674
|
def update_package_from_centos_stream(suts, package_name)
|
664
|
-
|
665
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
675
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
666
676
|
sut.install_package('centos-release-stream') unless sut.check_for_package('centos-release-stream')
|
667
677
|
install_latest_package_on(sut, package_name)
|
668
678
|
sut.uninstall_package('centos-release-stream')
|
@@ -670,8 +680,7 @@ module Simp::BeakerHelpers
|
|
670
680
|
end
|
671
681
|
|
672
682
|
def linux_errata( suts )
|
673
|
-
|
674
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
683
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
675
684
|
# Set the locale if not set
|
676
685
|
sut.set_env_var('LANG', 'en_US.UTF-8') unless sut.get_env_var('LANG')
|
677
686
|
|
@@ -688,9 +697,14 @@ module Simp::BeakerHelpers
|
|
688
697
|
if current_domain.empty?
|
689
698
|
new_fqdn = hostname + '.beaker.test'
|
690
699
|
|
691
|
-
|
692
|
-
|
693
|
-
|
700
|
+
safe_sed(sut, 's/#{hostname}.*/#{new_fqdn} #{hostname}/', '/etc/hosts')
|
701
|
+
|
702
|
+
if !sut.which('hostnamectl').empty?
|
703
|
+
on(sut, "hostnamectl set-hostname #{new_fqdn}")
|
704
|
+
else
|
705
|
+
on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
|
706
|
+
on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
|
707
|
+
end
|
694
708
|
|
695
709
|
if sut.file_exist?('/etc/sysconfig/network')
|
696
710
|
on(sut, "sed -s '/HOSTNAME=/d' /etc/sysconfig/network")
|
@@ -785,8 +799,7 @@ module Simp::BeakerHelpers
|
|
785
799
|
def rhel_rhsm_subscribe(suts, *opts)
|
786
800
|
require 'securerandom'
|
787
801
|
|
788
|
-
|
789
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
802
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
790
803
|
rhsm_opts = {
|
791
804
|
:username => ENV['BEAKER_RHSM_USER'],
|
792
805
|
:password => ENV['BEAKER_RHSM_PASS'],
|
@@ -838,8 +851,7 @@ module Simp::BeakerHelpers
|
|
838
851
|
end
|
839
852
|
|
840
853
|
def sosreport(suts, dest='sosreports')
|
841
|
-
|
842
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
854
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
843
855
|
install_latest_package_on(sut, 'sos')
|
844
856
|
on(sut, 'sosreport --batch')
|
845
857
|
|
@@ -854,8 +866,7 @@ module Simp::BeakerHelpers
|
|
854
866
|
end
|
855
867
|
|
856
868
|
def rhel_repo_enable(suts, repos)
|
857
|
-
|
858
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
869
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
859
870
|
Array(repos).each do |repo|
|
860
871
|
on(sut, %{subscription-manager repos --enable #{repo}})
|
861
872
|
end
|
@@ -863,8 +874,7 @@ module Simp::BeakerHelpers
|
|
863
874
|
end
|
864
875
|
|
865
876
|
def rhel_repo_disable(suts, repos)
|
866
|
-
|
867
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
877
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
868
878
|
Array(repos).each do |repo|
|
869
879
|
on(sut, %{subscription-manager repos --disable #{repo}}, :accept_all_exit_codes => true)
|
870
880
|
end
|
@@ -872,16 +882,14 @@ module Simp::BeakerHelpers
|
|
872
882
|
end
|
873
883
|
|
874
884
|
def rhel_rhsm_unsubscribe(suts)
|
875
|
-
|
876
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
885
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
877
886
|
on(sut, %{subscription-manager unregister}, :accept_all_exit_codes => true)
|
878
887
|
end
|
879
888
|
end
|
880
889
|
|
881
890
|
# Apply known OS fixes we need to run Beaker on each SUT
|
882
891
|
def fix_errata_on( suts = hosts )
|
883
|
-
|
884
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
892
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
885
893
|
if is_windows?(sut)
|
886
894
|
# Load the Windows requirements
|
887
895
|
require 'simp/beaker_helpers/windows'
|
@@ -1091,8 +1099,7 @@ module Simp::BeakerHelpers
|
|
1091
1099
|
def activate_interfaces(hosts)
|
1092
1100
|
return if ENV['BEAKER_no_fix_interfaces']
|
1093
1101
|
|
1094
|
-
|
1095
|
-
block_on(hosts, :run_in_parallel => parallel) do |host|
|
1102
|
+
block_on(hosts, :run_in_parallel => @run_in_parallel) do |host|
|
1096
1103
|
if host[:platform] =~ /windows/
|
1097
1104
|
puts " -- SKIPPING #{host} because it is windows"
|
1098
1105
|
next
|
@@ -1335,8 +1342,7 @@ module Simp::BeakerHelpers
|
|
1335
1342
|
noop => false
|
1336
1343
|
}
|
1337
1344
|
PLUGINSYNC_MANIFEST
|
1338
|
-
|
1339
|
-
apply_manifest_on(hosts, pluginsync_manifest, :run_in_parallel => parallel)
|
1345
|
+
apply_manifest_on(hosts, pluginsync_manifest, :run_in_parallel => @run_in_parallel)
|
1340
1346
|
end
|
1341
1347
|
|
1342
1348
|
|
@@ -1455,9 +1461,8 @@ module Simp::BeakerHelpers
|
|
1455
1461
|
ENV['BEAKER_PUPPET_COLLECTION'] = install_info[:puppet_collection]
|
1456
1462
|
end
|
1457
1463
|
|
1458
|
-
require 'beaker
|
1459
|
-
|
1460
|
-
run_puppet_install_helper(install_info[:puppet_install_type], install_info[:puppet_install_version])
|
1464
|
+
require 'beaker-puppet'
|
1465
|
+
install_puppet_on(hosts, version: install_info[:puppet_install_version])
|
1461
1466
|
end
|
1462
1467
|
|
1463
1468
|
# Configure all SIMP repos on a host and disable all repos in the disable Array
|
@@ -1494,18 +1499,28 @@ module Simp::BeakerHelpers
|
|
1494
1499
|
|
1495
1500
|
return if (ENV.fetch('SIMP_install_repos', 'yes') == 'no')
|
1496
1501
|
|
1497
|
-
|
1498
|
-
block_on(suts, :run_in_parallel => parallel) do |sut|
|
1502
|
+
block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
|
1499
1503
|
install_package_unless_present_on(sut, 'yum-utils')
|
1500
1504
|
|
1505
|
+
os = fact_on(sut, 'os.name')
|
1501
1506
|
release = fact_on(sut, 'os.release.major')
|
1502
1507
|
|
1508
|
+
# Work around Amazon 2 compatibility
|
1509
|
+
if (( os == 'Amazon' ) && ( "#{release}" == '2' ))
|
1510
|
+
release = '7'
|
1511
|
+
end
|
1512
|
+
|
1503
1513
|
install_package_unless_present_on(
|
1504
1514
|
sut,
|
1505
1515
|
'simp-release-community',
|
1506
1516
|
"https://download.simp-project.com/simp-release-community.el#{release}.rpm"
|
1507
1517
|
)
|
1508
1518
|
|
1519
|
+
# TODO: Remove this hack-around when there's a version for AL2
|
1520
|
+
if ( os == 'Amazon' )
|
1521
|
+
on(sut, %(sed -i 's/$releasever/#{release}/g' /etc/yum.repos.d/simp*))
|
1522
|
+
end
|
1523
|
+
|
1509
1524
|
to_disable = disable.dup
|
1510
1525
|
to_disable += ENV.fetch('BEAKER_SIMP_disable_repos', '').split(',').map(&:strip)
|
1511
1526
|
|
data/lib/simp/rake/beaker.rb
CHANGED
@@ -2,7 +2,8 @@ require 'rake'
|
|
2
2
|
require 'rake/clean'
|
3
3
|
require 'rake/tasklib'
|
4
4
|
require 'fileutils'
|
5
|
-
require '
|
5
|
+
require 'beaker/tasks/rake_task'
|
6
|
+
require 'beaker-rspec/rake_task'
|
6
7
|
require 'puppetlabs_spec_helper/tasks/fixtures'
|
7
8
|
|
8
9
|
module Simp; end
|
@@ -224,7 +225,46 @@ module Simp::Rake
|
|
224
225
|
nodesets << File.join(nodeset_path, 'default.yml')
|
225
226
|
end
|
226
227
|
|
228
|
+
refined_nodesets = []
|
229
|
+
|
227
230
|
nodesets.each do |nodeset_yml|
|
231
|
+
parsed_nodeset = ::Beaker::Options::HostsFileParser.parse_hosts_file(nodeset_yml)
|
232
|
+
|
233
|
+
# Default to multi-node testing for backwards compatibility
|
234
|
+
multi_node = (parsed_nodeset[:multi_node] == false ? false: true)
|
235
|
+
|
236
|
+
if multi_node
|
237
|
+
refined_nodesets.push(nodeset_yml)
|
238
|
+
else
|
239
|
+
parsed_nodeset_hosts = parsed_nodeset.delete(:HOSTS)
|
240
|
+
|
241
|
+
parsed_nodeset_hosts.each do |k,v|
|
242
|
+
|
243
|
+
v[:roles] ||= []
|
244
|
+
v[:roles] |= ['default']
|
245
|
+
|
246
|
+
tmp_nodeset = {
|
247
|
+
:HOSTS => { k => v },
|
248
|
+
:CONFIG => parsed_nodeset
|
249
|
+
}
|
250
|
+
|
251
|
+
tmp_nodeset_file = Tempfile.new("nodeset_#{k}-")
|
252
|
+
tmp_nodeset_file.write(tmp_nodeset.to_yaml)
|
253
|
+
tmp_nodeset_file.close
|
254
|
+
|
255
|
+
refined_nodesets.push(tmp_nodeset_file.path)
|
256
|
+
|
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
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
refined_nodesets.sort.each do |nodeset_yml|
|
228
268
|
unless File.file?(nodeset_yml)
|
229
269
|
# Get here if user has specified a non-existent nodeset or the
|
230
270
|
# implied `default` nodeset does not exist.
|
data/simp-beaker-helpers.gemspec
CHANGED
@@ -22,19 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.required_ruby_version = '>= 2.3.0'
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'beaker' , ['>= 4.17.0', '< 5.0.0']
|
25
|
-
s.add_runtime_dependency 'beaker-rspec' , '~>
|
25
|
+
s.add_runtime_dependency 'beaker-rspec' , '~> 7.1'
|
26
26
|
s.add_runtime_dependency 'beaker-puppet' , ['>= 1.18.14', '< 2.0.0']
|
27
27
|
s.add_runtime_dependency 'beaker-docker' , ['>= 0.8.3', '< 2.0.0']
|
28
28
|
s.add_runtime_dependency 'docker-api' , ['>= 2.1.0', '< 3.0.0']
|
29
29
|
s.add_runtime_dependency 'beaker-vagrant' , ['>= 0.6.4', '< 2.0.0']
|
30
|
-
s.add_runtime_dependency 'beaker-puppet_install_helper', '~> 0.9'
|
31
30
|
s.add_runtime_dependency 'highline' , '~> 2.0'
|
32
31
|
s.add_runtime_dependency 'nokogiri' , '~> 1.8'
|
33
32
|
|
34
|
-
# Because net-telnet dropped support for Ruby < 2.3.0
|
35
|
-
# TODO: Update this when we no longer support Ruby 2.1.9 (should be October 2018)
|
36
|
-
s.add_runtime_dependency 'net-telnet', '~> 0.1.1'
|
37
|
-
|
38
33
|
### s.files = Dir['Rakefile', '{bin,lib,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
|
39
34
|
s.files = `git ls-files`.split("\n")
|
40
35
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%
|
2
|
+
if ENV['BEAKER_HYPERVISOR']
|
3
|
+
hypervisor = ENV['BEAKER_HYPERVISOR']
|
4
|
+
else
|
5
|
+
hypervisor = 'vagrant'
|
6
|
+
end
|
7
|
+
-%>
|
8
|
+
HOSTS:
|
9
|
+
amzn2:
|
10
|
+
roles:
|
11
|
+
- default
|
12
|
+
platform: el-7-x86_64
|
13
|
+
box: gbailey/amzn2
|
14
|
+
hypervisor: <%= hypervisor %>
|
15
|
+
|
16
|
+
CONFIG:
|
17
|
+
log_level: verbose
|
18
|
+
synced_folder : disabled
|
19
|
+
type: aio
|
20
|
+
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
21
|
+
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
22
|
+
<% end -%>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
HOSTS:
|
9
9
|
el7:
|
10
10
|
roles:
|
11
|
+
- default
|
11
12
|
- el7
|
12
|
-
- master
|
13
13
|
platform: el-7-x86_64
|
14
14
|
box: centos/7
|
15
15
|
hypervisor: <%= hypervisor %>
|
@@ -18,13 +18,13 @@ HOSTS:
|
|
18
18
|
roles:
|
19
19
|
- el8
|
20
20
|
platform: el-8-x86_64
|
21
|
-
box:
|
21
|
+
box: centos/stream8
|
22
22
|
hypervisor: <%= hypervisor %>
|
23
23
|
|
24
24
|
CONFIG:
|
25
|
+
multi_node: <%= ['yes','true'].include?(ENV['BEAKER_multi_node']) ? true : false %>
|
25
26
|
log_level: verbose
|
26
27
|
type: aio
|
27
|
-
vagrant_memsize: 512
|
28
28
|
vagrant_cpus: 2
|
29
29
|
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
30
30
|
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
HOSTS:
|
9
9
|
oel7:
|
10
10
|
roles:
|
11
|
+
- default
|
11
12
|
- el7
|
12
|
-
- master
|
13
13
|
platform: el-7-x86_64
|
14
14
|
box: generic/oracle7
|
15
15
|
hypervisor: <%= hypervisor %>
|
@@ -24,7 +24,6 @@ HOSTS:
|
|
24
24
|
CONFIG:
|
25
25
|
log_level: verbose
|
26
26
|
type: aio
|
27
|
-
vagrant_memsize: 1024
|
28
27
|
vagrant_cpus: 2
|
29
28
|
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
30
29
|
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
@@ -7,6 +7,8 @@
|
|
7
7
|
-%>
|
8
8
|
HOSTS:
|
9
9
|
focal:
|
10
|
+
roles:
|
11
|
+
- default
|
10
12
|
platform: ubuntu-20.04-x86_64
|
11
13
|
box: ubuntu/focal64
|
12
14
|
hypervisor: <%= hypervisor %>
|
@@ -14,7 +16,6 @@ HOSTS:
|
|
14
16
|
CONFIG:
|
15
17
|
log_level: verbose
|
16
18
|
type: aio
|
17
|
-
vagrant_memsize: 512
|
18
19
|
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
19
20
|
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
20
21
|
<% end -%>
|
@@ -6,41 +6,41 @@ context 'after copy_fixture_modules_to( hosts )' do
|
|
6
6
|
copy_fixture_modules_to( hosts )
|
7
7
|
end
|
8
8
|
|
9
|
-
describe "fact_on(
|
9
|
+
describe "fact_on(default,'root_home')" do
|
10
10
|
it 'should not return value of `root_home`' do
|
11
|
-
expect(fact_on(
|
11
|
+
expect(fact_on(default, 'root_home')).to eq ''
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
describe "pfact_on(
|
15
|
+
describe "pfact_on(default,'root_home')" do
|
16
16
|
it 'should return value of `root_home`' do
|
17
|
-
expect(pfact_on(
|
17
|
+
expect(pfact_on(default, 'root_home')).to eq '/root'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe "pfact_on(
|
21
|
+
describe "pfact_on(default,'os.release.major')" do
|
22
22
|
it 'should return the value of `os.release.major`' do
|
23
|
-
expect(pfact_on(
|
23
|
+
expect(pfact_on(default, 'os.release.major')).to match(/.+/)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe "pfact_on(
|
27
|
+
describe "pfact_on(default,'os.release.foo')" do
|
28
28
|
it 'should not return the value of `os.release.foo`' do
|
29
|
-
expect(pfact_on(
|
29
|
+
expect(pfact_on(default, 'os.release.foo')).to eq ''
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe "pfact_on(
|
33
|
+
describe "pfact_on(default,'fips_enabled')" do
|
34
34
|
expected = (ENV['BEAKER_fips'] == 'yes')
|
35
35
|
|
36
36
|
it 'should return false' do
|
37
|
-
expect(pfact_on(
|
37
|
+
expect(pfact_on(default, 'fips_enabled')).to eq expected
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "pfact_on returns a hash" do
|
42
42
|
it 'should return a Hash' do
|
43
|
-
expect(pfact_on(
|
43
|
+
expect(pfact_on(default, 'os')).to be_a(Hash)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -4,21 +4,21 @@ require 'tmpdir'
|
|
4
4
|
|
5
5
|
context 'PKI operations' do
|
6
6
|
|
7
|
-
context 'after run_fake_pki_ca_on(
|
7
|
+
context 'after run_fake_pki_ca_on(default,hosts)' do
|
8
8
|
before(:all) do
|
9
9
|
copy_fixture_modules_to( hosts )
|
10
10
|
end
|
11
11
|
|
12
12
|
shared_examples_for 'a correctly copied keydist/ tree' do |test_dir|
|
13
13
|
it 'correctly copies keydist/ tree' do
|
14
|
-
on(
|
14
|
+
on(default, "ls -d #{test_dir}" +
|
15
15
|
" #{test_dir}/cacerts" +
|
16
16
|
" #{test_dir}/cacerts/cacert_*.pem"
|
17
17
|
)
|
18
18
|
|
19
19
|
hosts.each do |host|
|
20
20
|
name = host.node_name
|
21
|
-
on(
|
21
|
+
on(default, "ls -d #{test_dir}/#{name}/cacerts" +
|
22
22
|
" #{test_dir}/#{name}/#{name}.pem" +
|
23
23
|
" #{test_dir}/#{name}/#{name}.pub" +
|
24
24
|
" #{test_dir}/cacerts/cacert_*.pem"
|
@@ -29,10 +29,10 @@ context 'PKI operations' do
|
|
29
29
|
|
30
30
|
describe 'a Fake CA under /root' do
|
31
31
|
tmp_keydist_dir = Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
|
32
|
-
run_fake_pki_ca_on(
|
32
|
+
run_fake_pki_ca_on( default, hosts, tmp_keydist_dir )
|
33
33
|
|
34
34
|
it 'should create /root/pki' do
|
35
|
-
on(
|
35
|
+
on(default, 'test -d /root/pki')
|
36
36
|
end
|
37
37
|
|
38
38
|
it_behaves_like 'a correctly copied keydist/ tree', '/root/pki/keydist'
|
@@ -41,13 +41,13 @@ context 'PKI operations' do
|
|
41
41
|
|
42
42
|
describe 'after copy_keydist_to' do
|
43
43
|
test_dir = '/etc/puppetlabs/code/environments/production/modules/pki/files/keydist'
|
44
|
-
copy_keydist_to(
|
44
|
+
copy_keydist_to(default)
|
45
45
|
it_behaves_like 'a correctly copied keydist/ tree', test_dir
|
46
46
|
end
|
47
47
|
|
48
|
-
describe 'after copy_keydist_to(
|
48
|
+
describe 'after copy_keydist_to(default,"/tmp/foo")' do
|
49
49
|
test_dir = '/tmp/foo'
|
50
|
-
copy_keydist_to(
|
50
|
+
copy_keydist_to(default, test_dir)
|
51
51
|
it_behaves_like 'a correctly copied keydist/ tree', test_dir
|
52
52
|
end
|
53
53
|
|
@@ -5,8 +5,6 @@ require 'beaker-rspec'
|
|
5
5
|
require 'simp/beaker_helpers'
|
6
6
|
include Simp::BeakerHelpers
|
7
7
|
|
8
|
-
require 'beaker/puppet_install_helper'
|
9
|
-
|
10
8
|
unless ENV['BEAKER_provision'] == 'no'
|
11
9
|
hosts.each do |host|
|
12
10
|
unless Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed')
|
@@ -18,8 +18,40 @@ end
|
|
18
18
|
|
19
19
|
RSpec.configure do |c|
|
20
20
|
# ensure that environment OS is ready on each host
|
21
|
-
fix_errata_on
|
21
|
+
fix_errata_on hosts
|
22
|
+
|
23
|
+
# Detect cases in which no examples are executed (e.g., nodeset does not
|
24
|
+
# have hosts with required roles)
|
25
|
+
c.fail_if_no_examples = true
|
22
26
|
|
23
27
|
# Readable test descriptions
|
24
28
|
c.formatter = :documentation
|
29
|
+
|
30
|
+
# Configure all nodes in nodeset
|
31
|
+
c.before :suite do
|
32
|
+
begin
|
33
|
+
# Install modules and dependencies from spec/fixtures/modules
|
34
|
+
copy_fixture_modules_to( hosts )
|
35
|
+
begin
|
36
|
+
server = only_host_with_role(hosts, 'server')
|
37
|
+
rescue ArgumentError =>e
|
38
|
+
server = only_host_with_role(hosts, 'default')
|
39
|
+
end
|
40
|
+
|
41
|
+
# Generate and install PKI certificates on each SUT
|
42
|
+
Dir.mktmpdir do |cert_dir|
|
43
|
+
run_fake_pki_ca_on(server, hosts, cert_dir )
|
44
|
+
hosts.each{ |sut| copy_pki_to( sut, cert_dir, '/etc/pki/simp-testing' )}
|
45
|
+
end
|
46
|
+
|
47
|
+
# add PKI keys
|
48
|
+
copy_keydist_to(server)
|
49
|
+
rescue StandardError, ScriptError => e
|
50
|
+
if ENV['PRY']
|
51
|
+
require 'pry'; binding.pry
|
52
|
+
else
|
53
|
+
raise e
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
25
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-beaker-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.26.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaker
|
@@ -37,14 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '7.1'
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '7.1'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: beaker-puppet
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,20 +125,6 @@ dependencies:
|
|
125
125
|
- - "<"
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: 2.0.0
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: beaker-puppet_install_helper
|
130
|
-
requirement: !ruby/object:Gem::Requirement
|
131
|
-
requirements:
|
132
|
-
- - "~>"
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: '0.9'
|
135
|
-
type: :runtime
|
136
|
-
prerelease: false
|
137
|
-
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
requirements:
|
139
|
-
- - "~>"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0.9'
|
142
128
|
- !ruby/object:Gem::Dependency
|
143
129
|
name: highline
|
144
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,20 +153,6 @@ dependencies:
|
|
167
153
|
- - "~>"
|
168
154
|
- !ruby/object:Gem::Version
|
169
155
|
version: '1.8'
|
170
|
-
- !ruby/object:Gem::Dependency
|
171
|
-
name: net-telnet
|
172
|
-
requirement: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 0.1.1
|
177
|
-
type: :runtime
|
178
|
-
prerelease: false
|
179
|
-
version_requirements: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - "~>"
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: 0.1.1
|
184
156
|
description: " Beaker helper methods to help scaffold SIMP acceptance tests\n"
|
185
157
|
email: simp@simp-project.org
|
186
158
|
executables: []
|
@@ -219,6 +191,7 @@ files:
|
|
219
191
|
- lib/simp/beaker_helpers/windows.rb
|
220
192
|
- lib/simp/rake/beaker.rb
|
221
193
|
- simp-beaker-helpers.gemspec
|
194
|
+
- spec/acceptance/nodesets/amzn2.yml
|
222
195
|
- spec/acceptance/nodesets/default.yml
|
223
196
|
- spec/acceptance/nodesets/docker.yml
|
224
197
|
- spec/acceptance/nodesets/oel.yml
|