simp-rspec-puppet-facts 3.12.0 → 4.0.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/Rakefile +121 -7
- data/facts/3.6/amazon-2-x86_64.facts +6 -6
- data/facts/4.10/almalinux-8-x86_64.facts +1432 -0
- data/facts/4.10/almalinux-9-x86_64.facts +1502 -0
- data/facts/4.10/amazon-2-x86_64.facts +1257 -0
- data/facts/4.10/centos-7-x86_64.facts +1255 -0
- data/facts/4.10/centos-8-x86_64.facts +1338 -0
- data/facts/4.10/centos-9-x86_64.facts +1411 -0
- data/facts/4.10/oraclelinux-7-x86_64.facts +1263 -0
- data/facts/4.10/oraclelinux-8-x86_64.facts +1326 -0
- data/facts/4.10/oraclelinux-9-x86_64.facts +1390 -0
- data/facts/4.10/redhat-7-x86_64.facts +1255 -0
- data/facts/4.10/redhat-8-x86_64.facts +1341 -0
- data/facts/4.10/redhat-9-x86_64.facts +1412 -0
- data/facts/4.10/rocky-8-x86_64.facts +1341 -0
- data/facts/4.10/rocky-9-x86_64.facts +1412 -0
- data/facts/4.10/windows-2016-x64.facts +518 -0
- data/facts/4.10/windows-2019-x64.facts +522 -0
- data/facts/4.10/windows-2022-x64.facts +524 -0
- data/facts/5.1/almalinux-10-x86_64.facts +1437 -0
- data/facts/5.1/almalinux-8-x86_64.facts +1551 -0
- data/facts/5.1/almalinux-9-x86_64.facts +1600 -0
- data/facts/5.1/amazon-2-x86_64.facts +1432 -0
- data/facts/5.1/centos-10-x86_64.facts +1396 -0
- data/facts/5.1/centos-9-x86_64.facts +1537 -0
- data/facts/5.1/oraclelinux-10-x86_64.facts +1419 -0
- data/facts/5.1/oraclelinux-8-x86_64.facts +1545 -0
- data/facts/5.1/oraclelinux-9-x86_64.facts +1604 -0
- data/facts/5.1/redhat-10-x86_64.facts +1439 -0
- data/facts/5.1/redhat-8-x86_64.facts +1453 -0
- data/facts/5.1/redhat-9-x86_64.facts +1505 -0
- data/facts/5.1/rocky-10-x86_64.facts +1348 -0
- data/facts/5.1/rocky-8-x86_64.facts +1453 -0
- data/facts/5.1/rocky-9-x86_64.facts +1620 -0
- data/facts/5.1/windows-2016-x64.facts +525 -0
- data/facts/5.1/windows-2019-x64.facts +529 -0
- data/facts/5.1/windows-2022-x64.facts +531 -0
- data/facts/5.1/windows-2025-x64.facts +527 -0
- data/facts/scripts/gce_scrub_data/centos-6-x86_64.scrub.yaml +1 -1
- data/facts/scripts/gce_scrub_data/centos-7-x86_64.scrub.yaml +1 -1
- data/facts/scripts/gce_scrub_data/oraclelinux-6-x86_64.scrub.yaml +1 -1
- data/facts/scripts/gce_scrub_data/oraclelinux-7-x86_64.scrub.yaml +1 -1
- data/facts/scripts/gce_scrub_data/redhat-7-x86_64.scrub.yaml +1 -1
- data/facts/scripts/gce_scrub_data.rb +15 -15
- data/facts/scripts/get_facts.rb +3 -3
- data/lib/simp/rspec-puppet-facts.rb +84 -67
- data/lib/simp/version.rb +3 -1
- data/spec/acceptance/nodesets/{centos7.yml → almalinux10.yml} +5 -7
- data/spec/acceptance/nodesets/almalinux8.yml +1 -1
- data/spec/acceptance/nodesets/almalinux9.yml +1 -1
- data/spec/acceptance/nodesets/{centos8.yml → centos10.yml} +5 -7
- data/spec/acceptance/nodesets/centos9.yml +2 -2
- data/spec/acceptance/nodesets/oel10.yml +16 -0
- data/spec/acceptance/nodesets/oel8.yml +6 -13
- data/spec/acceptance/nodesets/oel9.yml +3 -2
- data/spec/acceptance/nodesets/{rhel7.yml → rhel10.yml} +5 -5
- data/spec/acceptance/nodesets/rhel8.yml +1 -1
- data/spec/acceptance/nodesets/rhel9.yml +1 -1
- data/spec/acceptance/nodesets/rocky10.yml +18 -0
- data/spec/acceptance/nodesets/rocky8.yml +2 -2
- data/spec/acceptance/nodesets/rocky9.yml +2 -2
- data/spec/acceptance/nodesets/win_2016.yml +1 -1
- data/spec/acceptance/nodesets/win_2019.yml +1 -1
- data/spec/acceptance/nodesets/win_2022.yml +1 -1
- data/spec/acceptance/nodesets/win_2025.yml +30 -0
- data/spec/acceptance/suites/default/00_default_spec.rb +21 -19
- data/spec/fixtures/metadata.json +6 -23
- data/spec/spec_helper_acceptance.rb +9 -52
- data/spec/unit/data_normalization_spec.rb +35 -0
- data/spec/unit/simp_rspec_puppet_facts_spec.rb +206 -0
- metadata +301 -227
- data/facts/Gemfile +0 -11
- data/facts/Vagrantfile +0 -236
- data/spec/acceptance/nodesets/centos7-vault.sh +0 -6
- data/spec/acceptance/nodesets/centos8-vault.sh +0 -8
- data/spec/acceptance/nodesets/oel7.yml +0 -23
- data/spec/data_normalization_spec.rb +0 -34
- data/spec/fixtures/metadata.json_with_missing_operatingsystem_support +0 -25
- data/spec/simp_rspec_puppet_facts_spec.rb +0 -198
|
@@ -9,20 +9,21 @@ describe 'look out muppets' do
|
|
|
9
9
|
let(:os_info) { fact_on(host, 'os') }
|
|
10
10
|
let(:os_arch) { fact_on(host, 'architecture') }
|
|
11
11
|
|
|
12
|
-
let(:fact_collection) { File.join(collection_dir, [os_info['name'], os_info['release']['major'].gsub(
|
|
12
|
+
let(:fact_collection) { File.join(collection_dir, [os_info['name'], os_info['release']['major'].gsub(%r{\s}, '_'), os_arch].join('-').downcase + '.facts') }
|
|
13
13
|
|
|
14
|
-
let(:host_data) { JSON.
|
|
14
|
+
let(:host_data) { JSON.parse(File.read(fact_collection)) }
|
|
15
15
|
|
|
16
|
+
# rubocop:disable RSpec/InstanceVariable
|
|
16
17
|
context "on #{host}" do
|
|
17
18
|
before(:all) do
|
|
18
19
|
@output = []
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
it '
|
|
22
|
+
it 'installs the simp_core module' do
|
|
22
23
|
on(host, 'puppet module install simp/simp_core')
|
|
23
24
|
end
|
|
24
25
|
|
|
25
|
-
it '
|
|
26
|
+
it 'disables the secondary network interface' do
|
|
26
27
|
interfaces = fact_on(host, 'interfaces').strip.split(',')
|
|
27
28
|
|
|
28
29
|
ifaces = {
|
|
@@ -31,43 +32,44 @@ describe 'look out muppets' do
|
|
|
31
32
|
'Ethernet 2' => 'netsh interface set interface "Ethernet 2" disable'
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
ifaces.
|
|
35
|
+
ifaces.each_key do |iface|
|
|
35
36
|
on(host, ifaces[iface]) if interfaces.include?(iface)
|
|
36
37
|
end
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
it '
|
|
40
|
+
it 'collects valid fact data' do
|
|
40
41
|
output = on(host, 'puppet facts show --show-legacy --render-as json').stdout.lines.last
|
|
41
42
|
|
|
42
|
-
expect
|
|
43
|
+
expect {
|
|
43
44
|
parsed_output = JSON.parse(output)
|
|
44
45
|
|
|
45
46
|
# Something changed in the puppet facts output so handle both cases
|
|
46
47
|
@output.push(parsed_output['values'] || parsed_output)
|
|
47
|
-
|
|
48
|
+
}.not_to raise_error
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
# This should work regardless of OS
|
|
51
|
-
it '
|
|
52
|
+
it 'has the "puppet_settings" fact' do
|
|
52
53
|
expect(@output.first['puppet_settings']).to be_a(Hash)
|
|
53
54
|
end
|
|
54
55
|
|
|
55
|
-
it '
|
|
56
|
+
it 'cleans up the data' do
|
|
56
57
|
str_data = JSON.generate(@output.first)
|
|
57
58
|
|
|
58
|
-
str_data = str_data.gsub(fact_on(host, 'fqdn'), 'foo.example.com')
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
str_data = str_data.gsub(fact_on(host, 'fqdn'), 'foo.example.com')
|
|
60
|
+
.gsub(fact_on(host, 'domain'), 'example.com')
|
|
61
|
+
.gsub(%(:"#{fact_on(host, 'hostname')}"), ':"foo"')
|
|
62
|
+
.gsub(%(:"#{fact_on(host, 'networking')['ip']}"), ':"10.0.2.15"')
|
|
63
|
+
.gsub(%(:"#{fact_on(host, 'networking')['netmask']}"), ':"255.255.0.0"')
|
|
64
|
+
.gsub(%(:"#{fact_on(host, 'networking')['network']}"), ':"10.0.2.0"')
|
|
65
|
+
.gsub(%r{"dhcp":"(.+?)"}, '"dhcp":"10.0.2.2"')
|
|
65
66
|
|
|
66
|
-
expect{JSON.parse(str_data)}.
|
|
67
|
+
expect { JSON.parse(str_data) }.not_to raise_error
|
|
67
68
|
|
|
68
69
|
FileUtils.mkdir_p(collection_dir) unless File.directory?(collection_dir)
|
|
69
|
-
File.open(fact_collection, 'w'){ |fh| fh.puts(JSON.pretty_generate(JSON.parse(str_data))) }
|
|
70
|
+
File.open(fact_collection, 'w') { |fh| fh.puts(JSON.pretty_generate(JSON.parse(str_data))) }
|
|
70
71
|
end
|
|
71
72
|
end
|
|
73
|
+
# rubocop:enable RSpec/InstanceVariable
|
|
72
74
|
end
|
|
73
75
|
end
|
data/spec/fixtures/metadata.json
CHANGED
|
@@ -7,39 +7,22 @@
|
|
|
7
7
|
"source": "https://github.com/op-ct/pupmod-simp-dummy",
|
|
8
8
|
"project_page": "https://github.com/op-ct/pupmod-simp-dummy",
|
|
9
9
|
"issues_url": "https://github.com/op-ct/pupmod-simp-dummy/issues",
|
|
10
|
-
"dependencies": [
|
|
11
|
-
],
|
|
12
|
-
"requirements": [
|
|
13
|
-
],
|
|
10
|
+
"dependencies": [],
|
|
11
|
+
"requirements": [],
|
|
14
12
|
"operatingsystem_support": [
|
|
15
13
|
{
|
|
16
14
|
"operatingsystem": "CentOS",
|
|
17
15
|
"operatingsystemrelease": [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
16
|
+
"9",
|
|
17
|
+
"10"
|
|
20
18
|
]
|
|
21
19
|
},
|
|
22
20
|
{
|
|
23
21
|
"operatingsystem": "RedHat",
|
|
24
22
|
"operatingsystemrelease": [
|
|
25
|
-
"
|
|
26
|
-
"
|
|
23
|
+
"9",
|
|
24
|
+
"10"
|
|
27
25
|
]
|
|
28
26
|
}
|
|
29
|
-
],
|
|
30
|
-
"puppet_version": [
|
|
31
|
-
"5.5",
|
|
32
|
-
"6.0",
|
|
33
|
-
"6.4",
|
|
34
|
-
"6.5",
|
|
35
|
-
"6.6",
|
|
36
|
-
"6.16",
|
|
37
|
-
"6.18",
|
|
38
|
-
"6.22",
|
|
39
|
-
"7.0",
|
|
40
|
-
"7.0",
|
|
41
|
-
"7.4",
|
|
42
|
-
"7.5",
|
|
43
|
-
"7.6"
|
|
44
27
|
]
|
|
45
28
|
}
|
|
@@ -13,18 +13,14 @@ include BeakerWindows::WindowsFeature
|
|
|
13
13
|
unless ENV['BEAKER_provision'] == 'no'
|
|
14
14
|
to_skip = []
|
|
15
15
|
|
|
16
|
-
facter_ng = ( ENV['BEAKER_facter_ng'] == 'yes' ? true : false )
|
|
17
|
-
|
|
18
16
|
hosts.each do |host|
|
|
19
|
-
# Install
|
|
20
|
-
if
|
|
21
|
-
install_pe
|
|
22
|
-
elsif ENV['FACTER_GEM_VERSION']
|
|
17
|
+
# Install OpenVox
|
|
18
|
+
if ENV['FACTER_GEM_VERSION']
|
|
23
19
|
begin
|
|
24
20
|
install_puppet_from_gem_on(
|
|
25
21
|
host,
|
|
26
22
|
version: ENV['PUPPET_VERSION'],
|
|
27
|
-
facter_version: ENV['FACTER_GEM_VERSION']
|
|
23
|
+
facter_version: ENV['FACTER_GEM_VERSION'],
|
|
28
24
|
)
|
|
29
25
|
|
|
30
26
|
# Make scaffold dirs?
|
|
@@ -41,10 +37,6 @@ unless ENV['BEAKER_provision'] == 'no'
|
|
|
41
37
|
end
|
|
42
38
|
else
|
|
43
39
|
install_puppet
|
|
44
|
-
|
|
45
|
-
if facter_ng
|
|
46
|
-
on(host, 'puppet config set facterng true')
|
|
47
|
-
end
|
|
48
40
|
end
|
|
49
41
|
end
|
|
50
42
|
|
|
@@ -53,37 +45,6 @@ unless ENV['BEAKER_provision'] == 'no'
|
|
|
53
45
|
end
|
|
54
46
|
end
|
|
55
47
|
|
|
56
|
-
hosts.each do |host|
|
|
57
|
-
# https://petersouter.xyz/testing-windows-with-beaker-without-cygwin/
|
|
58
|
-
case host['platform']
|
|
59
|
-
when /windows/
|
|
60
|
-
GEOTRUST_GLOBAL_CA = <<-EOM.freeze
|
|
61
|
-
-----BEGIN CERTIFICATE-----
|
|
62
|
-
MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
|
|
63
|
-
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
|
|
64
|
-
YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
|
|
65
|
-
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
|
|
66
|
-
R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
|
|
67
|
-
9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
|
|
68
|
-
fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
|
|
69
|
-
iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
|
|
70
|
-
1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
|
|
71
|
-
bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
|
|
72
|
-
MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
|
|
73
|
-
ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
|
|
74
|
-
uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
|
|
75
|
-
Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
|
|
76
|
-
tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
|
|
77
|
-
PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
|
|
78
|
-
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
|
|
79
|
-
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
|
|
80
|
-
-----END CERTIFICATE-----
|
|
81
|
-
EOM
|
|
82
|
-
install_cert_on_windows(host, 'geotrustglobal', GEOTRUST_GLOBAL_CA)
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
|
|
87
48
|
RSpec.configure do |c|
|
|
88
49
|
# ensure that environment OS is ready on each host
|
|
89
50
|
fix_errata_on(hosts)
|
|
@@ -93,15 +54,11 @@ RSpec.configure do |c|
|
|
|
93
54
|
|
|
94
55
|
# Configure all nodes in nodeset
|
|
95
56
|
c.before :suite do
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
else
|
|
103
|
-
raise e
|
|
104
|
-
end
|
|
105
|
-
end
|
|
57
|
+
# Install modules and dependencies from spec/fixtures/modules
|
|
58
|
+
copy_fixture_modules_to(hosts)
|
|
59
|
+
rescue StandardError, ScriptError => e
|
|
60
|
+
raise e unless ENV['PRY']
|
|
61
|
+
require 'pry'
|
|
62
|
+
binding.pry # rubocop:disable Lint/Debugger
|
|
106
63
|
end
|
|
107
64
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Simp::RspecPuppetFacts' do
|
|
4
|
+
facts_top_path = File.expand_path('../../facts', File.dirname(__FILE__))
|
|
5
|
+
facter_paths = Dir[File.join(facts_top_path, '?.?')].sort
|
|
6
|
+
|
|
7
|
+
facter_paths.each do |facter_path|
|
|
8
|
+
warn "=== facter_path = '#{facter_path}'"
|
|
9
|
+
facter_version = File.basename(facter_path)
|
|
10
|
+
describe "factsets for Facter #{facter_version}" do
|
|
11
|
+
Dir[File.join(facter_path, '*.facts')].each do |facts_file|
|
|
12
|
+
os = File.basename(facts_file).sub(%r{\.facts$}, '')
|
|
13
|
+
context "for #{os}" do
|
|
14
|
+
let(:facts) { YAML.load_file facts_file }
|
|
15
|
+
|
|
16
|
+
it 'uses the fqdn "foo.example.com"' do
|
|
17
|
+
expect(facts['networking']['fqdn']).to eq 'foo.example.com'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'uses the ipaddress "10.0.2.15"' do
|
|
21
|
+
expect(facts['networking']['ip']).to eq '10.0.2.15'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'has a grub_version' do
|
|
25
|
+
if facts['kernel'] == 'windows'
|
|
26
|
+
expect(facts).not_to have_key('grub_version')
|
|
27
|
+
else
|
|
28
|
+
expect(facts['grub_version']).to match(%r{^(0\.9|2\.)})
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Simp::RspecPuppetFacts' do
|
|
4
|
+
describe '#on_supported_os' do
|
|
5
|
+
context 'Without parameter' do
|
|
6
|
+
subject(:subject_on_supported_os) { on_supported_os }
|
|
7
|
+
|
|
8
|
+
context 'Without a metadata.json file' do
|
|
9
|
+
it { expect { subject_on_supported_os }.to raise_error(StandardError, %r{Can't find metadata\.json}) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'With a metadata.json file' do
|
|
13
|
+
before(:each) do
|
|
14
|
+
Dir.chdir(File.join(File.dirname(__FILE__), '../fixtures'))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
after(:each) do
|
|
18
|
+
Dir.chdir(File.join(File.dirname(__FILE__), '../..'))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'returns a hash' do
|
|
22
|
+
expect(on_supported_os.class).to eq Hash
|
|
23
|
+
end
|
|
24
|
+
it 'has 4 elements' do
|
|
25
|
+
expect(subject_on_supported_os.size).to be >= 4
|
|
26
|
+
end
|
|
27
|
+
it 'returns supported OS' do
|
|
28
|
+
expect(subject_on_supported_os.keys.sort).to include 'centos-9-x86_64'
|
|
29
|
+
expect(subject_on_supported_os.keys.sort).to include 'centos-10-x86_64'
|
|
30
|
+
expect(subject_on_supported_os.keys.sort).to include 'redhat-9-x86_64'
|
|
31
|
+
expect(subject_on_supported_os.keys.sort).to include 'redhat-10-x86_64'
|
|
32
|
+
end
|
|
33
|
+
it 'returns SIMP-specific OS facts' do
|
|
34
|
+
grub_version_facts = subject_on_supported_os.map do |os, data|
|
|
35
|
+
{ os => data.slice(:uid_min, :grub_version) }
|
|
36
|
+
end
|
|
37
|
+
expect(grub_version_facts).to include(
|
|
38
|
+
{ 'centos-10-x86_64' => { uid_min: '1000', grub_version: '2.12' } },
|
|
39
|
+
)
|
|
40
|
+
expect(grub_version_facts).to include(
|
|
41
|
+
{ 'centos-9-x86_64' => { uid_min: '1000', grub_version: '2.06' } },
|
|
42
|
+
)
|
|
43
|
+
expect(grub_version_facts).to include(
|
|
44
|
+
{ 'redhat-10-x86_64' => { uid_min: '1000', grub_version: '2.12' } },
|
|
45
|
+
)
|
|
46
|
+
expect(grub_version_facts).to include(
|
|
47
|
+
{ 'redhat-9-x86_64' => { uid_min: '1000', grub_version: '2.06' } },
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context 'When specifying supported_os=redhat-8-x86_64,redhat-9-x86_64' do
|
|
54
|
+
subject(:subject_on_supported_os) do
|
|
55
|
+
on_supported_os(
|
|
56
|
+
{
|
|
57
|
+
supported_os: [
|
|
58
|
+
{
|
|
59
|
+
'operatingsystem' => 'RedHat',
|
|
60
|
+
'operatingsystemrelease' => [
|
|
61
|
+
'8',
|
|
62
|
+
'9',
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'returns a hash' do
|
|
71
|
+
expect(subject_on_supported_os.class).to eq Hash
|
|
72
|
+
end
|
|
73
|
+
it 'has 2 elements' do
|
|
74
|
+
expect(subject_on_supported_os.size).to eq 2
|
|
75
|
+
end
|
|
76
|
+
it 'returns supported OS' do
|
|
77
|
+
expect(subject_on_supported_os.keys.sort).to eq [
|
|
78
|
+
'redhat-8-x86_64',
|
|
79
|
+
'redhat-9-x86_64',
|
|
80
|
+
]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
context 'When specifying SIMP_FACTS_OS=centos,redhat-9-x86_64' do
|
|
85
|
+
subject(:subject_on_supported_os) do
|
|
86
|
+
x = ENV['SIMP_FACTS_OS']
|
|
87
|
+
ENV['SIMP_FACTS_OS'] = 'centos,redhat-9-x86_64'
|
|
88
|
+
h = on_supported_os
|
|
89
|
+
ENV['SIMP_FACTS_OS'] = x
|
|
90
|
+
h
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'returns a hash' do
|
|
94
|
+
expect(subject_on_supported_os.class).to eq Hash
|
|
95
|
+
end
|
|
96
|
+
it 'has 3 elements' do
|
|
97
|
+
expect(subject_on_supported_os.size).to eq 3
|
|
98
|
+
end
|
|
99
|
+
it 'returns supported OS' do
|
|
100
|
+
expect(subject_on_supported_os.keys.sort).to eq [
|
|
101
|
+
'centos-10-x86_64',
|
|
102
|
+
'centos-9-x86_64',
|
|
103
|
+
'redhat-9-x86_64',
|
|
104
|
+
]
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
context 'When specifying wrong supported_os' do
|
|
109
|
+
subject(:subject_on_supported_os) do
|
|
110
|
+
on_supported_os(
|
|
111
|
+
{
|
|
112
|
+
supported_os: [
|
|
113
|
+
{
|
|
114
|
+
'operatingsystem' => 'Debian',
|
|
115
|
+
'operatingsystemrelease' => [
|
|
116
|
+
'X',
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'outputs warning message', skip: 'rspec issue: No longer able to catch message on stdout or stderr' do
|
|
125
|
+
expect { subject_on_supported_os }.to output(%r{No facts were found in the FacterDB}).to_stdout
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe '#selinux_facts' do
|
|
131
|
+
context 'When :enforcing' do
|
|
132
|
+
subject(:subject_selinux_facts) { selinux_facts(:enforcing, {}) }
|
|
133
|
+
|
|
134
|
+
it 'returns a hash' do
|
|
135
|
+
expect(subject_selinux_facts.class).to eq Hash
|
|
136
|
+
end
|
|
137
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
|
|
138
|
+
subject(:subject_selinux_facts) { selinux_facts(:enforcing, { tmp_mount_dev_shm: 'rw,noatime' }) }
|
|
139
|
+
|
|
140
|
+
it 'has a :tmp_mount_dev_shm key' do
|
|
141
|
+
expect(subject_selinux_facts.key?(:tmp_mount_dev_shm)).to be true
|
|
142
|
+
end
|
|
143
|
+
it ':tmp_mount_dev_shm should include "seclabel"' do
|
|
144
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).to match(%r{\bseclabel\b})
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
|
|
148
|
+
subject(:subject_selinux_facts) { selinux_facts(:enforcing, { tmp_mount_dev_shm: 'rw,noatime,seclabel' }) }
|
|
149
|
+
|
|
150
|
+
it ':tmp_mount_dev_shm should include "seclabel"' do
|
|
151
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).to match(%r{\bseclabel\b})
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
context 'When :permissive' do
|
|
157
|
+
subject(:subject_selinux_facts) { selinux_facts(:permissive, {}) }
|
|
158
|
+
|
|
159
|
+
it 'returns a hash' do
|
|
160
|
+
expect(subject_selinux_facts.class).to eq Hash
|
|
161
|
+
end
|
|
162
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
|
|
163
|
+
subject(:subject_selinux_facts) { selinux_facts(:permissive, { tmp_mount_dev_shm: 'rw,noatime' }) }
|
|
164
|
+
|
|
165
|
+
it 'has a :tmp_mount_dev_shm key' do
|
|
166
|
+
expect(subject_selinux_facts.key?(:tmp_mount_dev_shm)).to be true
|
|
167
|
+
end
|
|
168
|
+
it ':tmp_mount_dev_shm should include "seclabel"' do
|
|
169
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).to match(%r{\bseclabel\b})
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
|
|
173
|
+
subject(:subject_selinux_facts) { selinux_facts(:permissive, { tmp_mount_dev_shm: 'rw,noatime,seclabel' }) }
|
|
174
|
+
|
|
175
|
+
it ':tmp_mount_dev_shm should include "seclabel"' do
|
|
176
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).to match(%r{\bseclabel\b})
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
context 'When :disabled' do
|
|
182
|
+
subject(:subject_selinux_facts) { selinux_facts(:disabled, {}) }
|
|
183
|
+
|
|
184
|
+
it 'returns a hash' do
|
|
185
|
+
expect(subject_selinux_facts.class).to eq Hash
|
|
186
|
+
end
|
|
187
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
|
|
188
|
+
subject(:subject_selinux_facts) { selinux_facts(:disabled, { tmp_mount_dev_shm: 'rw,noatime' }) }
|
|
189
|
+
|
|
190
|
+
it 'has a :tmp_mount_dev_shm key' do
|
|
191
|
+
expect(subject_selinux_facts.key?(:tmp_mount_dev_shm)).to be true
|
|
192
|
+
end
|
|
193
|
+
it ':tmp_mount_dev_shm should not include "seclabel"' do
|
|
194
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).not_to match(%r{\bseclabel\b})
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
|
|
198
|
+
subject(:subject_selinux_facts) { selinux_facts(:disabled, { tmp_mount_dev_shm: 'rw,noatime,seclabel' }) }
|
|
199
|
+
|
|
200
|
+
it ':tmp_mount_dev_shm should not include "seclabel"' do
|
|
201
|
+
expect(subject_selinux_facts[:tmp_mount_dev_shm]).not_to match(%r{\bseclabel\b})
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|