simp-beaker-helpers 1.34.3 → 1.35.0
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 +4 -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 +174 -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
@@ -4,7 +4,6 @@ require 'json'
|
|
4
4
|
test_name 'Inspec STIG Profile'
|
5
5
|
|
6
6
|
describe 'Inspec STIG Profile' do
|
7
|
-
|
8
7
|
profiles_to_validate = ['disa_stig']
|
9
8
|
|
10
9
|
hosts.each do |host|
|
@@ -14,38 +13,39 @@ describe 'Inspec STIG Profile' do
|
|
14
13
|
profile_path = File.join(
|
15
14
|
fixtures_path,
|
16
15
|
'inspec_profiles',
|
17
|
-
"#{fact_on(host, 'os.name')}-#{fact_on(host, 'os.release.major')}-#{profile}"
|
16
|
+
"#{fact_on(host, 'os.name')}-#{fact_on(host, 'os.release.major')}-#{profile}",
|
18
17
|
)
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
skip("No matching profile available at #{profile_path}")
|
23
|
-
end
|
24
|
-
else
|
25
|
-
before(:all) do
|
19
|
+
if File.exist?(profile_path)
|
20
|
+
let(:inspec) do
|
26
21
|
Simp::BeakerHelpers::Inspec.enable_repo_on(hosts)
|
27
|
-
|
28
|
-
|
29
|
-
# If we don't do this, the variable gets reset
|
30
|
-
@inspec_report = { :data => nil }
|
22
|
+
Simp::BeakerHelpers::Inspec.new(host, profile)
|
31
23
|
end
|
32
24
|
|
33
|
-
|
34
|
-
@inspec.run
|
35
|
-
end
|
25
|
+
let(:inspec_report_data) { inspec.process_inspec_results }
|
36
26
|
|
37
|
-
|
38
|
-
|
27
|
+
# rubocop:disable RSpec/RepeatedDescription
|
28
|
+
it 'runs inspec' do
|
29
|
+
inspec.run
|
30
|
+
end
|
31
|
+
# rubocop:enable RSpec/RepeatedDescription
|
39
32
|
|
40
|
-
|
33
|
+
it 'has an inspec report' do
|
34
|
+
expect(inspec_report_data).not_to be_nil
|
41
35
|
|
42
|
-
|
36
|
+
inspec.write_report(inspec_report_data)
|
43
37
|
end
|
44
38
|
|
45
|
-
it '
|
46
|
-
expect(
|
47
|
-
puts
|
39
|
+
it 'has a report' do
|
40
|
+
expect(inspec_report_data[:report]).not_to be_nil
|
41
|
+
puts inspec_report_data[:report]
|
42
|
+
end
|
43
|
+
else
|
44
|
+
# rubocop:disable RSpec/RepeatedDescription
|
45
|
+
it 'runs inspec' do
|
46
|
+
skip("No matching profile available at #{profile_path}")
|
48
47
|
end
|
48
|
+
# rubocop:enable RSpec/RepeatedDescription
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -66,7 +66,7 @@ describe 'Offline mode' do
|
|
66
66
|
'seabios',
|
67
67
|
'sqlite-devel',
|
68
68
|
'util-linux',
|
69
|
-
'which'
|
69
|
+
'which',
|
70
70
|
]
|
71
71
|
|
72
72
|
on(host, %(yum -y install #{required_packages.join(' ')}))
|
@@ -84,7 +84,15 @@ describe 'Offline mode' do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'installs the VirtualBox extension pack' do
|
87
|
-
on(
|
87
|
+
on(
|
88
|
+
host,
|
89
|
+
[
|
90
|
+
'VERSION=$(VBoxManage --version | tail -1 | cut -f 1 -d "r")',
|
91
|
+
'&& curl -Lo ${TMPDIR}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack http://download.virtualbox.org/virtualbox/${VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack',
|
92
|
+
'&& yes | VBoxManage extpack install ${TMPDIR}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack',
|
93
|
+
'&& rm -rf ${TMPDIR}/Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack',
|
94
|
+
].join(' '),
|
95
|
+
)
|
88
96
|
end
|
89
97
|
|
90
98
|
it 'adds the build user to the vboxusers group' do
|
@@ -97,9 +105,28 @@ describe 'Offline mode' do
|
|
97
105
|
|
98
106
|
it 'installs RPM for the build user' do
|
99
107
|
# Install RVM
|
100
|
-
on(
|
108
|
+
on(
|
109
|
+
host,
|
110
|
+
[
|
111
|
+
%(#{build_user_cmd} "for i in {1..5}; do {),
|
112
|
+
'gpg2 --keyserver hkp://pgp.mit.edu --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3',
|
113
|
+
'|| gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3',
|
114
|
+
'|| gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3; }',
|
115
|
+
'&& { gpg2 --keyserver hkp://pgp.mit.edu --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB',
|
116
|
+
'|| gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB; }',
|
117
|
+
'&& break || sleep 1; done',
|
118
|
+
].join(' '),
|
119
|
+
)
|
101
120
|
on(host, %(#{build_user_cmd} "gpg2 --refresh-keys"))
|
102
|
-
on(
|
121
|
+
on(
|
122
|
+
host,
|
123
|
+
[
|
124
|
+
%(#{build_user_cmd} "curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer -o rvm-installer),
|
125
|
+
'curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer.asc -o rvm-installer.asc',
|
126
|
+
'gpg2 --verify rvm-installer.asc rvm-installer',
|
127
|
+
'bash rvm-installer',
|
128
|
+
].join(' && '),
|
129
|
+
)
|
103
130
|
on(host, %(#{build_user_cmd} "rvm install 2.4.4 --disable-binary"))
|
104
131
|
on(host, %(#{build_user_cmd} "rvm use --default 2.4.4"))
|
105
132
|
on(host, %(#{build_user_cmd} "rvm all do gem install bundler -v '~> 1.16' --no-document"))
|
@@ -118,14 +145,14 @@ describe 'Offline mode' do
|
|
118
145
|
build_user_homedir = on(host, "readlink -f ~#{build_user}").output.strip
|
119
146
|
vagrant_testdir = "#{build_user_homedir}/vagrant_test"
|
120
147
|
|
121
|
-
vagrant_test_file =
|
122
|
-
Vagrant.configure("2") do |c|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
148
|
+
vagrant_test_file = <<~EOM
|
149
|
+
Vagrant.configure("2") do |c|
|
150
|
+
c.vm.define 'test' do |v|
|
151
|
+
v.vm.hostname = 'centos7.test.net'
|
152
|
+
v.vm.box = 'centos/7'
|
153
|
+
v.vm.box_check_update = 'false'
|
154
|
+
end
|
155
|
+
end
|
129
156
|
EOM
|
130
157
|
|
131
158
|
host.mkdir_p(vagrant_testdir)
|
@@ -148,18 +175,22 @@ end
|
|
148
175
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; bundle update"))
|
149
176
|
end
|
150
177
|
|
178
|
+
# rubocop:disable RSpec/RepeatedExample
|
151
179
|
it 'runs a network-connected test' do
|
152
180
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; rake beaker:suites"))
|
153
181
|
end
|
182
|
+
# rubocop:enable RSpec/RepeatedExample
|
154
183
|
|
155
184
|
it 'disables all internet network traffic via iptables' do
|
156
185
|
on(host, %(iptables -I OUTPUT -d `ip route | awk '/default/ {print $3}'`/16 -j ACCEPT))
|
157
186
|
on(host, 'iptables -A OUTPUT -j DROP')
|
158
187
|
end
|
159
188
|
|
189
|
+
# rubocop:disable RSpec/RepeatedExample
|
160
190
|
xit 'runs a network-disconnected test' do
|
161
191
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; rake beaker:suites"))
|
162
192
|
end
|
193
|
+
# rubocop:enable RSpec/RepeatedExample
|
163
194
|
end
|
164
195
|
end
|
165
196
|
end
|
@@ -13,9 +13,7 @@ HOSTS:
|
|
13
13
|
CONFIG:
|
14
14
|
log_level: verbose
|
15
15
|
type: aio
|
16
|
-
|
17
|
-
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
18
|
-
<% end -%>
|
16
|
+
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
|
19
17
|
libvirt:
|
20
18
|
# Ensure that we use the best option available
|
21
19
|
'cpu_mode': 'host-passthrough'
|
@@ -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,61 +3,79 @@ require 'spec_helper_acceptance'
|
|
3
3
|
hosts.each do |host|
|
4
4
|
describe 'take a snapshot' do
|
5
5
|
context "on #{host}" do
|
6
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
6
7
|
it 'creates a file that should be saved' do
|
7
8
|
on(host, 'echo "keep" > /root/keep')
|
8
9
|
end
|
10
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
9
11
|
|
12
|
+
# rubocop:disable RSpec/RepeatedExample
|
10
13
|
it 'takes a snapshot' do
|
11
14
|
Simp::BeakerHelpers::Snapshot.save(host, 'test')
|
12
15
|
end
|
16
|
+
# rubocop:enable RSpec/RepeatedExample
|
13
17
|
|
18
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
14
19
|
it 'creates a file that should be removed' do
|
15
20
|
on(host, 'echo "trash" > /root/trash')
|
16
21
|
end
|
22
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
17
23
|
|
24
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
18
25
|
it 'restores a snapshot' do
|
19
26
|
Simp::BeakerHelpers::Snapshot.restore(host, 'test')
|
20
27
|
end
|
28
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
21
29
|
|
22
|
-
it '
|
30
|
+
it 'has the keep file' do
|
23
31
|
expect(host.file_exist?('/root/keep')).to be true
|
24
32
|
end
|
25
33
|
|
26
|
-
|
34
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
35
|
+
it 'does not have the trash file' do
|
27
36
|
expect(host.file_exist?('/root/trash')).to be false
|
28
37
|
end
|
38
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
29
39
|
|
30
40
|
it 'creates a second file that should be saved' do
|
31
41
|
on(host, 'echo "keep2" > /root/keep2')
|
32
42
|
end
|
33
43
|
|
44
|
+
# rubocop:disable RSpec/RepeatedExample
|
34
45
|
it 'takes a snapshot with the same name' do
|
35
46
|
Simp::BeakerHelpers::Snapshot.save(host, 'test')
|
36
47
|
end
|
48
|
+
# rubocop:enable RSpec/RepeatedExample
|
37
49
|
|
50
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
38
51
|
it 'creates a file that should be removed' do
|
39
52
|
on(host, 'echo "trash" > /root/trash')
|
40
53
|
end
|
54
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
41
55
|
|
56
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
42
57
|
it 'restores a snapshot' do
|
43
58
|
Simp::BeakerHelpers::Snapshot.restore(host, 'test')
|
44
59
|
end
|
60
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
45
61
|
|
46
|
-
it '
|
62
|
+
it 'has all keep files' do
|
47
63
|
expect(host.file_exist?('/root/keep')).to be true
|
48
64
|
expect(host.file_exist?('/root/keep2')).to be true
|
49
65
|
end
|
50
66
|
|
51
|
-
|
67
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
68
|
+
it 'does not have the trash file' do
|
52
69
|
expect(host.file_exist?('/root/trash')).to be false
|
53
70
|
end
|
71
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
54
72
|
|
55
73
|
it 'takes a snapshot with a different name' do
|
56
74
|
Simp::BeakerHelpers::Snapshot.save(host, 'test2')
|
57
75
|
end
|
58
76
|
|
59
77
|
it 'can list the snapshots' do
|
60
|
-
expect(Simp::BeakerHelpers::Snapshot.list(host)).to eq [
|
78
|
+
expect(Simp::BeakerHelpers::Snapshot.list(host)).to eq [host.to_s, 'test', 'test2']
|
61
79
|
end
|
62
80
|
|
63
81
|
it 'can query for a specific snapshot' do
|
@@ -67,12 +85,14 @@ hosts.each do |host|
|
|
67
85
|
end
|
68
86
|
|
69
87
|
it 'restores to the internal base' do
|
70
|
-
|
71
|
-
|
88
|
+
Simp::BeakerHelpers::Snapshot.restore_to_base(host)
|
89
|
+
end
|
72
90
|
|
91
|
+
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
73
92
|
it 'creates a file that should be saved' do
|
74
93
|
on(host, 'echo "keep" > /root/keep')
|
75
94
|
end
|
95
|
+
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
76
96
|
|
77
97
|
it 'creates a handoff snapshot for further tests' do
|
78
98
|
Simp::BeakerHelpers::Snapshot.save(host, 'handoff')
|
@@ -24,18 +24,18 @@ hosts.each do |host|
|
|
24
24
|
|
25
25
|
it 'restores the snapshot' do
|
26
26
|
if init_snapshot == 'missing'
|
27
|
-
expect { Simp::BeakerHelpers::Snapshot.restore(host, init_snapshot) }.to raise_error(
|
27
|
+
expect { Simp::BeakerHelpers::Snapshot.restore(host, init_snapshot) }.to raise_error(%r{not found})
|
28
28
|
Simp::BeakerHelpers::Snapshot.restore_to_base(host)
|
29
29
|
else
|
30
30
|
Simp::BeakerHelpers::Snapshot.restore(host, init_snapshot)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
it '
|
34
|
+
it 'has the keep file' do
|
35
35
|
expect(host.file_exist?('/root/keep')).to be true
|
36
36
|
end
|
37
37
|
|
38
|
-
it '
|
38
|
+
it 'does not have the tracking file' do
|
39
39
|
expect(host.file_exist?('/root/tracking')).to be false
|
40
40
|
end
|
41
41
|
end
|
@@ -3,44 +3,46 @@ require 'spec_helper_acceptance'
|
|
3
3
|
test_name 'SSG Functionality Validation'
|
4
4
|
|
5
5
|
describe 'run the SSG against an SCAP profile' do
|
6
|
-
|
7
6
|
hosts.each do |host|
|
8
7
|
context "on #{host}" do
|
8
|
+
ssg = nil
|
9
|
+
ssg_report = nil
|
10
|
+
|
9
11
|
before(:all) do
|
10
|
-
|
12
|
+
ssg = Simp::BeakerHelpers::SSG.new(host)
|
11
13
|
|
12
14
|
# If we don't do this, the variable gets reset
|
13
|
-
|
15
|
+
ssg_report = { data: nil }
|
14
16
|
end
|
15
17
|
|
16
|
-
it '
|
17
|
-
profiles =
|
18
|
+
it 'runs the SSG' do
|
19
|
+
profiles = ssg.get_profiles
|
18
20
|
|
19
|
-
profile = profiles.find{|x| x
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
profile = profiles.find { |x| x.include?('_stig') } ||
|
22
|
+
profiles.find { |x| x.include?('_cui') } ||
|
23
|
+
profiles.find { |x| x.include?('_ospp') } ||
|
24
|
+
profiles.find { |x| x.include?('_standard') } ||
|
25
|
+
profiles.last
|
24
26
|
|
25
27
|
expect(profile).not_to be_nil
|
26
|
-
|
28
|
+
ssg.evaluate(profile)
|
27
29
|
end
|
28
30
|
|
29
|
-
it '
|
31
|
+
it 'has an SSG report' do
|
30
32
|
# Validate that the filter works
|
31
33
|
filter = '_rule_audit'
|
32
34
|
host_exclusions = ['ssh_']
|
33
35
|
|
34
|
-
|
36
|
+
ssg_report[:data] = ssg.process_ssg_results(filter, host_exclusions)
|
35
37
|
|
36
|
-
expect(
|
38
|
+
expect(ssg_report[:data]).not_to be_nil
|
37
39
|
|
38
|
-
|
40
|
+
ssg.write_report(ssg_report[:data])
|
39
41
|
end
|
40
42
|
|
41
|
-
it '
|
42
|
-
expect(
|
43
|
-
puts
|
43
|
+
it 'has a report' do
|
44
|
+
expect(ssg_report[:data][:report]).not_to be_nil
|
45
|
+
puts ssg_report[:data][:report]
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -27,63 +27,61 @@ RSpec.configure do |c|
|
|
27
27
|
|
28
28
|
# Configure all nodes in nodeset
|
29
29
|
c.before :suite do
|
30
|
-
|
31
|
-
copy_fixture_modules_to( hosts )
|
32
|
-
|
33
|
-
nonwin = hosts.dup
|
34
|
-
nonwin.delete_if {|h| h[:platform] =~ /windows/ }
|
30
|
+
copy_fixture_modules_to(hosts)
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
rescue ArgumentError => e
|
39
|
-
server = only_host_with_role(nonwin, 'default')
|
40
|
-
end
|
41
|
-
# Generate and install PKI certificates on each SUT
|
42
|
-
Dir.mktmpdir do |cert_dir|
|
43
|
-
run_fake_pki_ca_on(server, nonwin, cert_dir )
|
44
|
-
nonwin.each{ |sut| copy_pki_to( sut, cert_dir, '/etc/pki/simp-testing' )}
|
45
|
-
end
|
32
|
+
nonwin = hosts.dup
|
33
|
+
nonwin.delete_if { |h| h[:platform].include?('windows') }
|
46
34
|
|
47
|
-
|
48
|
-
|
49
|
-
rescue
|
50
|
-
|
51
|
-
require 'pry'; binding.pry
|
52
|
-
else
|
53
|
-
raise e
|
54
|
-
end
|
35
|
+
begin
|
36
|
+
server = only_host_with_role(nonwin, 'server')
|
37
|
+
rescue ArgumentError => e
|
38
|
+
server = only_host_with_role(nonwin, 'default')
|
55
39
|
end
|
40
|
+
# Generate and install PKI certificates on each SUT
|
41
|
+
Dir.mktmpdir do |cert_dir|
|
42
|
+
run_fake_pki_ca_on(server, nonwin, cert_dir)
|
43
|
+
nonwin.each { |sut| copy_pki_to(sut, cert_dir, '/etc/pki/simp-testing') }
|
44
|
+
end
|
45
|
+
|
46
|
+
# add PKI keys
|
47
|
+
copy_keydist_to(server)
|
48
|
+
rescue StandardError, ScriptError => e
|
49
|
+
raise e unless ENV['PRY']
|
50
|
+
require 'pry'
|
51
|
+
binding.pry # rubocop:disable Lint/Debugger
|
56
52
|
end
|
57
53
|
end
|
58
54
|
|
59
55
|
describe 'windows' do
|
56
|
+
let(:hieradata) do
|
57
|
+
{
|
58
|
+
'test::foo' => 'test'
|
59
|
+
}
|
60
|
+
end
|
60
61
|
|
61
|
-
let(:
|
62
|
-
'test::foo' => 'test'
|
63
|
-
}}
|
64
|
-
|
65
|
-
let(:manifest){ 'notify { "test": message => lookup("test::foo")}' }
|
62
|
+
let(:manifest) { 'notify { "test": message => lookup("test::foo")}' }
|
66
63
|
|
67
64
|
hosts.each do |host|
|
68
65
|
context "on #{host}" do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
66
|
+
let(:hiera_config) do
|
67
|
+
{
|
68
|
+
'version' => 5,
|
69
|
+
'hierarchy' => [
|
70
|
+
{
|
71
|
+
'name' => 'Common',
|
72
|
+
'path' => 'common.yaml'
|
73
|
+
},
|
74
|
+
{
|
75
|
+
'name' => 'SIMP Compliance Engine',
|
76
|
+
'lookup_key' => 'compliance_markup::enforcement'
|
77
|
+
},
|
78
|
+
],
|
79
|
+
'defaults' => {
|
80
|
+
'data_hash' => 'yaml_data',
|
81
|
+
'datadir' => hiera_datadir(host)
|
82
|
+
}
|
85
83
|
}
|
86
|
-
|
84
|
+
end
|
87
85
|
|
88
86
|
if Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed')
|
89
87
|
Simp::BeakerHelpers::Snapshot.restore(host, 'puppet_installed')
|
@@ -93,19 +91,19 @@ describe 'windows' do
|
|
93
91
|
|
94
92
|
describe 'windows hosts coexising with linux hosts' do
|
95
93
|
context "on #{host}" do
|
96
|
-
it '
|
94
|
+
it 'has puppet installed' do
|
97
95
|
on(host, 'puppet --version')
|
98
96
|
end
|
99
97
|
|
100
|
-
it '
|
98
|
+
it 'is able to set the hiera config' do
|
101
99
|
set_hiera_config_on(host, hiera_config)
|
102
100
|
end
|
103
101
|
|
104
|
-
it '
|
102
|
+
it 'is able to set the hieradata' do
|
105
103
|
set_hieradata_on(host, hieradata)
|
106
104
|
end
|
107
105
|
|
108
|
-
it '
|
106
|
+
it 'is able to run puppet' do
|
109
107
|
output = apply_manifest_on(host, manifest).stdout
|
110
108
|
|
111
109
|
expect(output).to include "defined 'message' as 'test'"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
HOSTS:
|
3
3
|
win:
|
4
4
|
roles:
|
5
|
-
|
5
|
+
- windows
|
6
6
|
platform: windows-server-amd64
|
7
7
|
box: gusztavvargadr/windows-server
|
8
8
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -14,7 +14,7 @@ HOSTS:
|
|
14
14
|
gce_machine_type: n1-standard-2
|
15
15
|
el7:
|
16
16
|
roles:
|
17
|
-
|
17
|
+
- default
|
18
18
|
platform: el-7-x86_64
|
19
19
|
box: centos/7
|
20
20
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -23,4 +23,4 @@ HOSTS:
|
|
23
23
|
CONFIG:
|
24
24
|
log_level: verbose
|
25
25
|
type: aio
|
26
|
-
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', '
|
26
|
+
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
HOSTS:
|
3
3
|
win:
|
4
4
|
roles:
|
5
|
-
|
5
|
+
- windows
|
6
6
|
platform: windows-server-amd64
|
7
7
|
box: devopsgroup-io/windows_server-2012r2-standard-amd64-nocm
|
8
8
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -16,7 +16,7 @@ HOSTS:
|
|
16
16
|
gce_machine_type: n1-standard-2
|
17
17
|
el7:
|
18
18
|
roles:
|
19
|
-
|
19
|
+
- default
|
20
20
|
platform: el-7-x86_64
|
21
21
|
box: centos/7
|
22
22
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -25,4 +25,4 @@ HOSTS:
|
|
25
25
|
CONFIG:
|
26
26
|
log_level: verbose
|
27
27
|
type: aio
|
28
|
-
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', '
|
28
|
+
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
HOSTS:
|
3
3
|
win:
|
4
4
|
roles:
|
5
|
-
|
5
|
+
- windows
|
6
6
|
platform: windows-server-amd64
|
7
7
|
box: peru/windows-server-2016-standard-x64-eval
|
8
8
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -15,7 +15,7 @@ HOSTS:
|
|
15
15
|
gce_machine_type: n1-standard-2
|
16
16
|
el7:
|
17
17
|
roles:
|
18
|
-
|
18
|
+
- default
|
19
19
|
platform: el-7-x86_64
|
20
20
|
box: centos/7
|
21
21
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -24,4 +24,4 @@ HOSTS:
|
|
24
24
|
CONFIG:
|
25
25
|
log_level: verbose
|
26
26
|
type: aio
|
27
|
-
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', '
|
27
|
+
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
HOSTS:
|
3
3
|
win:
|
4
4
|
roles:
|
5
|
-
|
5
|
+
- windows
|
6
6
|
platform: windows-server-amd64
|
7
7
|
box: gusztavvargadr/windows-server
|
8
8
|
box_version: "~> 1809"
|
@@ -15,7 +15,7 @@ HOSTS:
|
|
15
15
|
gce_machine_type: n1-standard-2
|
16
16
|
el7:
|
17
17
|
roles:
|
18
|
-
|
18
|
+
- default
|
19
19
|
platform: el-7-x86_64
|
20
20
|
box: centos/7
|
21
21
|
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
|
@@ -24,4 +24,4 @@ HOSTS:
|
|
24
24
|
CONFIG:
|
25
25
|
log_level: verbose
|
26
26
|
type: aio
|
27
|
-
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', '
|
27
|
+
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
|