simp-rspec-puppet-facts 3.13.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +121 -7
  3. data/facts/3.6/amazon-2-x86_64.facts +6 -6
  4. data/facts/5.1/almalinux-10-x86_64.facts +1437 -0
  5. data/facts/5.1/almalinux-8-x86_64.facts +1551 -0
  6. data/facts/5.1/almalinux-9-x86_64.facts +1600 -0
  7. data/facts/5.1/amazon-2-x86_64.facts +1432 -0
  8. data/facts/5.1/centos-10-x86_64.facts +1396 -0
  9. data/facts/5.1/centos-9-x86_64.facts +1537 -0
  10. data/facts/5.1/oraclelinux-10-x86_64.facts +1419 -0
  11. data/facts/5.1/oraclelinux-8-x86_64.facts +1545 -0
  12. data/facts/5.1/oraclelinux-9-x86_64.facts +1604 -0
  13. data/facts/5.1/redhat-10-x86_64.facts +1439 -0
  14. data/facts/5.1/redhat-8-x86_64.facts +1453 -0
  15. data/facts/5.1/redhat-9-x86_64.facts +1505 -0
  16. data/facts/5.1/rocky-10-x86_64.facts +1348 -0
  17. data/facts/5.1/rocky-8-x86_64.facts +1453 -0
  18. data/facts/5.1/rocky-9-x86_64.facts +1620 -0
  19. data/facts/5.1/windows-2016-x64.facts +525 -0
  20. data/facts/5.1/windows-2019-x64.facts +529 -0
  21. data/facts/5.1/windows-2022-x64.facts +531 -0
  22. data/facts/5.1/windows-2025-x64.facts +527 -0
  23. data/facts/scripts/gce_scrub_data/centos-6-x86_64.scrub.yaml +1 -1
  24. data/facts/scripts/gce_scrub_data/centos-7-x86_64.scrub.yaml +1 -1
  25. data/facts/scripts/gce_scrub_data/oraclelinux-6-x86_64.scrub.yaml +1 -1
  26. data/facts/scripts/gce_scrub_data/oraclelinux-7-x86_64.scrub.yaml +1 -1
  27. data/facts/scripts/gce_scrub_data/redhat-7-x86_64.scrub.yaml +1 -1
  28. data/facts/scripts/gce_scrub_data.rb +15 -15
  29. data/facts/scripts/get_facts.rb +3 -3
  30. data/lib/simp/rspec-puppet-facts.rb +84 -67
  31. data/lib/simp/version.rb +3 -1
  32. data/spec/acceptance/nodesets/{centos7.yml → almalinux10.yml} +5 -7
  33. data/spec/acceptance/nodesets/almalinux8.yml +1 -1
  34. data/spec/acceptance/nodesets/almalinux9.yml +1 -1
  35. data/spec/acceptance/nodesets/{centos8.yml → centos10.yml} +5 -7
  36. data/spec/acceptance/nodesets/centos9.yml +2 -2
  37. data/spec/acceptance/nodesets/oel10.yml +16 -0
  38. data/spec/acceptance/nodesets/oel8.yml +6 -13
  39. data/spec/acceptance/nodesets/oel9.yml +3 -2
  40. data/spec/acceptance/nodesets/{rhel7.yml → rhel10.yml} +5 -5
  41. data/spec/acceptance/nodesets/rhel8.yml +1 -1
  42. data/spec/acceptance/nodesets/rhel9.yml +1 -1
  43. data/spec/acceptance/nodesets/rocky10.yml +18 -0
  44. data/spec/acceptance/nodesets/rocky8.yml +2 -2
  45. data/spec/acceptance/nodesets/rocky9.yml +2 -2
  46. data/spec/acceptance/nodesets/win_2016.yml +1 -1
  47. data/spec/acceptance/nodesets/win_2019.yml +1 -1
  48. data/spec/acceptance/nodesets/win_2022.yml +1 -1
  49. data/spec/acceptance/nodesets/win_2025.yml +30 -0
  50. data/spec/acceptance/suites/default/00_default_spec.rb +21 -19
  51. data/spec/fixtures/metadata.json +6 -23
  52. data/spec/spec_helper_acceptance.rb +9 -52
  53. data/spec/unit/data_normalization_spec.rb +35 -0
  54. data/spec/unit/simp_rspec_puppet_facts_spec.rb +206 -0
  55. metadata +276 -236
  56. data/facts/Gemfile +0 -11
  57. data/facts/Vagrantfile +0 -236
  58. data/spec/acceptance/nodesets/centos7-vault.sh +0 -6
  59. data/spec/acceptance/nodesets/centos8-vault.sh +0 -8
  60. data/spec/acceptance/nodesets/oel7.yml +0 -23
  61. data/spec/data_normalization_spec.rb +0 -34
  62. data/spec/fixtures/metadata.json_with_missing_operatingsystem_support +0 -25
  63. data/spec/simp_rspec_puppet_facts_spec.rb +0 -198
data/facts/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['~>3']
2
- source ENV['GEM_SOURCE'] || "https://rubygems.org"
3
-
4
- gem 'json', :require => false
5
- gem 'puppet', puppetversion, :require => false
6
-
7
- if facterversion = ENV['FACTER_GEM_VERSION']
8
- gem 'facter', facterversion, :require => false
9
- else
10
- gem 'facter', :require => false
11
- end
data/facts/Vagrantfile DELETED
@@ -1,236 +0,0 @@
1
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
2
- VAGRANTFILE_API_VERSION = '2'
3
-
4
- # Used with google provider unless ENV['GOOGLE_ZONE'] is set
5
- DEFAULT_GOOGLE_ZONE = 'us-east1-b'
6
-
7
- VM_FQDN = 'foo.example.com'
8
-
9
- GOOGLE_PROJECT_ID = ENV.fetch('GOOGLE_CLOUD_PROJECT_ID', nil)
10
-
11
- unless GOOGLE_PROJECT_ID
12
- $stderr.puts("Warning: GOOGLE_CLOUD_PROJECT_ID not set, will not use GCE")
13
- end
14
-
15
- VALID_OS_TYPES = [
16
- 'CENTOS',
17
- 'OEL',
18
- 'RHEL'
19
- ]
20
-
21
- found_os = false
22
-
23
- VALID_OS_TYPES.each do |os|
24
- if ENV.fetch(os, nil)
25
- found_os = true
26
- break
27
- end
28
- end
29
-
30
- unless found_os
31
- $stderr.puts("Error: You must set one of ['#{VALID_OS_TYPES.join(', ')}'] as an environment variable to 'yes'")
32
- exit 1
33
- end
34
-
35
- if Dir.glob('modules/*').empty?
36
- $stderr.puts('No modules found in the "modules" directory. Hit ^C to exit or Enter to proceed.')
37
- $stdin.gets
38
- end
39
-
40
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
41
- config.vm.hostname = VM_FQDN
42
-
43
- config.vm.provider 'virtualbox' do |vb|
44
- # centos/* boxes don't install vbox guest additions
45
- unless Vagrant.has_plugin?('vagrant-vbguest')
46
- msg = 'ERROR: plugin `vagrant-vbguest` is missing. To fix, run:' +
47
- "\n\n\tvagrant plugin install vagrant-vbguest\n\n"
48
- warn msg unless @_msg
49
- @_msg = msg
50
- exit 99
51
- end
52
- end
53
-
54
- if GOOGLE_PROJECT_ID
55
- # Reference: https://github.com/mitchellh/vagrant-google#configuration
56
- config.vm.provider 'google' do |google, override|
57
-
58
- # The Client Email address for your Service Account
59
- google.google_project_id = ENV.fetch('GOOGLE_CLOUD_PROJECT_ID')
60
-
61
- # The Client Email address for your Service Account
62
- # (it should end with gserviceaccount.com)
63
- google.google_client_email = ENV.fetch('GOOGLE_CLIENT_EMAIL')
64
-
65
- if ENV.key? 'GOOGLE_KEY_LOCATION'
66
- # The location of the P12 private key file matching your Service Account.
67
- google.google__key_location = ENV['GOOGLE_KEY_LOCATION']
68
- else
69
- # The location of the JSON private key file matching your Service Account.
70
- # "/path/to/your/private-key.json"
71
- google.google_json_key_location = ENV.fetch('GOOGLE_JSON_KEY_LOCATION')
72
- end
73
-
74
- # The zone name where the instance will be created.
75
- # Make sure to set this to trigger the zone_config
76
- google.zone = _zone = ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE)
77
-
78
- google.zone_config _zone do |zone|
79
- # zone.name = 'vagrant-rspec-puppet-facts'
80
- zone.machine_type = ENV['GOOGLE_MACHINE_TYPE'] || 'g1-small'
81
- zone.zone = _zone
82
- zone.metadata = {'custom' => 'metadata', 'testing' => 'foobarbaz'}
83
- zone.scopes = ['monitoring', 'https://www.googleapis.com/auth/compute']
84
- zone.tags = ['vagrant', 'simp-rspec-puppet-facts', 'temporary']
85
- end
86
-
87
- override.ssh.username = ENV.fetch('GOOGLE_SSH_USERNAME')
88
- override.ssh.private_key_path = ENV.fetch('GOOGLE_SSH_KEY', '~/.ssh/id_rsa')
89
- override.vm.box = 'google/gce'
90
- end
91
- end
92
-
93
- # Optional: RHEL subscription information
94
- #
95
- # A licensed RHEL subscription is required to use yum to configure VMs, and
96
- # yum is needed to sey up the environment to collect most SIMP facter facts.
97
- #
98
- # Some providers' images (e.g., Google) already have RHEL subscriptions.
99
- # However, if yours doesn't (ex: virtualbox), you can install the vagrant
100
- # plugin `vagrant-registration` and set the RHEL_SUB_* environment variables
101
- # below:
102
- if Vagrant.has_plugin?('vagrant-registration')
103
- if ENV['RHEL_SUB_USERNAME'] && ENV['RHEL_SUB_PASSWORD']
104
- ENV['RHEL'] = 'yes'
105
- config.registration.username = ENV['RHEL_SUB_USERNAME']
106
- config.registration.password = ENV['RHEL_SUB_PASSWORD']
107
- elsif ENV['RHEL_SUB_ORG'] && ENV['RHEL_SUB_ACTIVATIONKEY']
108
- ENV['RHEL'] = 'yes'
109
- config.registration.org = ENV['RHEL_SUB_ORG']
110
- config.registration.activationkey = ENV['RHEL_SUB_ACTIVATIONKEY']
111
- end
112
- end
113
-
114
- # The centos/* machines won't support vboxsf
115
- # config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ['.git/']
116
- config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
117
-
118
- if ENV['CENTOS'] == 'yes'
119
- config.vm.define "centos-6-x86_64" do |host|
120
- host.vm.provider 'virtualbox' do |vb,override|
121
- override.vm.box = "centos/6"
122
- end
123
-
124
- if GOOGLE_PROJECT_ID
125
- host.vm.provider 'google' do |google,override|
126
- google.name = 'foo-centos6-64'
127
- google.zone = ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE)
128
- google.zone_config ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE) do |zone|
129
- zone.image = 'centos-6-v20170717'
130
- end
131
- end
132
- end
133
-
134
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
135
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'centos 6'"
136
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
137
- end
138
-
139
- config.vm.define "centos-7-x86_64" do |host|
140
- host.vm.provider 'virtualbox' do |vb,override|
141
- override.vm.box = "centos/7"
142
- end
143
-
144
- if GOOGLE_PROJECT_ID
145
- host.vm.provider 'google' do |google,override|
146
- google.name = 'foo-centos7-64'
147
- google.zone = ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE)
148
- google.zone_config ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE) do |zone|
149
- zone.image = 'centos-7-v20170719'
150
- end
151
- end
152
- end
153
-
154
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
155
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'centos 7'"
156
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
157
- end
158
- end
159
-
160
- if ENV['OEL'] == 'yes'
161
- config.vm.define "oel-6-x86_64" do |host|
162
- host.vm.provider 'virtualbox' do |vb,override|
163
- override.vm.box = "elastic/oel-6-x86_64"
164
- end
165
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
166
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'centos 6'"
167
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
168
- end
169
-
170
- config.vm.define "oel-7-x86_64" do |host|
171
- host.vm.provider 'virtualbox' do |vb,override|
172
- override.vm.box = "elastic/oel-7-x86_64"
173
- end
174
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
175
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'centos 7'"
176
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
177
- end
178
- end
179
-
180
- if ENV['RHEL'] == 'yes'
181
- config.vm.define "redhat-6-x86_64" do |host|
182
- os = 'redhat'
183
- ver = '6'
184
- if Vagrant.has_plugin?('vagrant-rsync-back')
185
- config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/", ".idea/"], args: ['--verbose', '--archive', '--delete', '-z', '--prune-empty-dirs', "--include='*/'", "--include='#{os}-#{ver}-x86_64.facts'", "--exclude='*'"]
186
- end
187
-
188
- config.vm.provider 'virtualbox' do |vb,override|
189
- override.vm.box = "anandbitra/redhat-6.5"
190
- end
191
-
192
- if GOOGLE_PROJECT_ID
193
- host.vm.provider 'google' do |google,override|
194
- google.zone = ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE)
195
- google.zone_config ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE) do |zone|
196
- zone.image = 'rhel-6-v20170717'
197
- end
198
- end
199
- end
200
-
201
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
202
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'#{os} #{ver}'"
203
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
204
- end
205
-
206
- config.vm.define "redhat-7-x86_64" do |host|
207
- os = 'redhat'
208
- ver = '7'
209
- # host.vm.hostname = 'redhat-7-x86_64'
210
- if Vagrant.has_plugin?('vagrant-rsync-back')
211
- config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/", ".idea/"], args: ['--verbose', '--archive', '--delete', '-z', '--prune-empty-dirs', "--include='*/'", "--include='#{os}-#{ver}-x86_64.facts'", "--exclude='*'"]
212
- end
213
-
214
- host.vm.provider 'virtualbox' do |vb,override|
215
- override.vm.box = "mrlesmithjr/rhel-7"
216
- end
217
-
218
- if GOOGLE_PROJECT_ID
219
- host.vm.provider 'google' do |google,override|
220
- # google.name = 'foo'
221
- google.zone = ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE)
222
- google.zone_config ENV.fetch('GOOGLE_ZONE', DEFAULT_GOOGLE_ZONE) do |zone|
223
- zone.image = 'rhel-7-v20170719'
224
- end
225
- end
226
- end
227
-
228
- host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
229
- host.vm.provision "shell", path: "scripts/get_facts_for_each_facter.sh", args: "'#{os} #{ver}'"
230
- host.vm.provision "shell", inline: "/sbin/shutdown -h now" unless ENV['SHUTDOWN'] == 'no'
231
- end
232
- end
233
- end
234
-
235
- # -*- mode: ruby -*-
236
- # vi: set ft=ruby :
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- yum-config-manager --setopt=base.baseurl='http://vault.centos.org/7.9.2009/os/$basearch/' --save
4
- yum-config-manager --setopt=updates.baseurl='http://vault.centos.org/7.9.2009/updates/$basearch/' --save
5
- yum-config-manager --setopt=extras.baseurl='http://vault.centos.org/7.9.2009/extras/$basearch/' --save
6
- sed -i -e '/^\(mirrorlist\|metalink\)=/s/^/#/' /etc/yum.repos.d/CentOS-*.repo
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- yum-config-manager --setopt=baseos.baseurl='https://vault.centos.org/8-stream/BaseOS/$basearch/os/' --save
4
- yum-config-manager --setopt=appstream.baseurl='https://vault.centos.org/8-stream/AppStream/$basearch/os/' --save
5
- yum-config-manager --setopt=extras-common.baseurl='https://vault.centos.org/8-stream/extras/$basearch/extras-common/' --save
6
- yum-config-manager --setopt=extras.baseurl='https://vault.centos.org/8-stream/extras/$basearch/os/' --save
7
-
8
- sed -i -e '/^\(mirrorlist\|metalink\)=/s/^/#/' /etc/yum.repos.d/CentOS-*.repo
@@ -1,23 +0,0 @@
1
- <%
2
- if ENV['BEAKER_HYPERVISOR']
3
- hypervisor = ENV['BEAKER_HYPERVISOR']
4
- else
5
- hypervisor = 'vagrant'
6
- end
7
- -%>
8
- HOSTS:
9
- oel7:
10
- roles:
11
- - linux
12
- - default
13
- platform: el-7-x86_64
14
- box: generic/oracle7
15
- hypervisor: <%= hypervisor %>
16
- vagrant_memsize: 2048
17
-
18
- CONFIG:
19
- log_level: verbose
20
- type: aio
21
- <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
22
- puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
23
- <% end -%>
@@ -1,34 +0,0 @@
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(/\.facts$/,'')
13
- context "for #{os}" do
14
- before :all do
15
- @facts = YAML.load_file facts_file
16
- end
17
-
18
- it 'should use the fqdn "foo.example.com"' do
19
- expect(@facts['fqdn']).to be == 'foo.example.com'
20
- end
21
-
22
- it 'should use the ipaddress "10.0.2.15"' do
23
- expect(@facts['ipaddress']).to be == '10.0.2.15'
24
- end
25
-
26
- it 'should have a grub_version' do
27
- expect(@facts['grub_version']).to match /^(0\.9|2\.)/
28
- end
29
- end
30
- end
31
- end
32
- end
33
-
34
- end
@@ -1,25 +0,0 @@
1
- {
2
- "name": "mcanevet-mymodule",
3
- "version": "1.0.0",
4
- "author": "Mickaël Canévet",
5
- "summary": "My puppet modules",
6
- "license": "Apache-2.0",
7
- "source": "https://github.com/mcanevet/puppet-mymodule",
8
- "project_page": "https://github.com/mcanevet/puppet-mymodule",
9
- "issues_url": "https://github.com/mcanevet/puppet-mymodule/issues",
10
- "dependencies": [
11
- ],
12
- "requirements": [
13
- ],
14
- "puppet_version": [
15
- "2.7",
16
- "3.0",
17
- "3.1",
18
- "3.2",
19
- "3.3",
20
- "3.4",
21
- "3.5",
22
- "3.6",
23
- "3.7"
24
- ]
25
- }
@@ -1,198 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Simp::RspecPuppetFacts' do
4
-
5
-
6
- describe '#on_supported_os' do
7
-
8
- context 'Without parameter' do
9
- subject { on_supported_os() }
10
-
11
- context 'Without a metadata.json file' do
12
- it { expect { subject }.to raise_error(StandardError, /Can't find metadata\.json/) }
13
- end
14
-
15
- context 'With a metadata.json file' do
16
- before :all do
17
- Dir.chdir( File.join(File.dirname(__FILE__),'fixtures'))
18
- end
19
-
20
- it 'should return a hash' do
21
- expect( on_supported_os().class ).to eq Hash
22
- end
23
- it 'should have 4 elements' do
24
- expect(subject.size).to be >= 4
25
- end
26
- it 'should return supported OS' do
27
- expect(subject.keys.sort).to include 'centos-7-x86_64'
28
- expect(subject.keys.sort).to include 'centos-8-x86_64'
29
- expect(subject.keys.sort).to include 'redhat-7-x86_64'
30
- expect(subject.keys.sort).to include 'redhat-8-x86_64'
31
- end
32
- it 'should return SIMP-specific OS facts' do
33
- grub_version_facts = subject.map{ |os,data| {os =>
34
- data.select{ |x,v| x == :uid_min || x == :grub_version }}}
35
- expect( grub_version_facts ).to include(
36
- {"centos-8-x86_64"=>{:uid_min=>"1000", :grub_version=>"2.03"}}
37
- )
38
- expect( grub_version_facts ).to include(
39
- {"centos-7-x86_64"=>{:uid_min=>"1000", :grub_version=>"2.02~beta2"}}
40
- )
41
- expect( grub_version_facts ).to include(
42
- {"redhat-8-x86_64"=>{:uid_min=>"1000", :grub_version=>"2.03"}}
43
- )
44
- expect( grub_version_facts ).to include(
45
- {"redhat-7-x86_64"=>{:uid_min=>"1000", :grub_version=>"2.02~beta2"}}
46
- )
47
- end
48
- end
49
- end
50
-
51
- context 'When specifying supported_os=redhat-6-x86_64,redhat-7-x86_64' do
52
- subject {
53
- on_supported_os(
54
- {
55
- :supported_os => [
56
- {
57
- "operatingsystem" => "RedHat",
58
- "operatingsystemrelease" => [
59
- "6",
60
- "7"
61
- ]
62
- }
63
- ]
64
- }
65
- )
66
- }
67
- it 'should return a hash' do
68
- expect(subject.class).to eq Hash
69
- end
70
- it 'should have 2 elements' do
71
- expect(subject.size).to eq 2
72
- end
73
- it 'should return supported OS' do
74
- expect(subject.keys.sort).to eq [
75
- 'redhat-6-x86_64',
76
- 'redhat-7-x86_64',
77
- ]
78
- end
79
- end
80
-
81
- context 'When specifying SIMP_FACTS_OS=redhat-6-x86_64,redhat-7-x86_64' do
82
- subject {
83
- x = ENV['SIMP_FACTS_OS']
84
- ENV['SIMP_FACTS_OS']='centos,redhat-7-x86_64'
85
- h = on_supported_os()
86
- ENV['SIMP_FACTS_OS']=x
87
- h
88
- }
89
- it 'should return a hash' do
90
- expect(subject.class).to eq Hash
91
- end
92
- it 'should have 3 elements' do
93
- expect(subject.size).to eq 3
94
- end
95
- it 'should return supported OS' do
96
- expect(subject.keys.sort).to eq [
97
- 'centos-7-x86_64',
98
- 'centos-8-x86_64',
99
- 'redhat-7-x86_64',
100
- ]
101
- end
102
- end
103
-
104
-
105
- context 'When specifying wrong supported_os' do
106
- subject {
107
- on_supported_os(
108
- {
109
- :supported_os => [
110
- {
111
- "operatingsystem" => "Debian",
112
- "operatingsystemrelease" => [
113
- "X",
114
- ],
115
- },
116
- ]
117
- }
118
- )
119
- }
120
-
121
-
122
- it 'should output warning message', skip: "rspec issue: No longer able to catch message on stdout or stderr" do
123
- expect { subject }.to output(%r(No facts were found in the FacterDB)).to_stdout
124
- end
125
- end
126
- end
127
-
128
-
129
-
130
- describe '#selinux_facts' do
131
- context 'When :enforcing' do
132
- subject { selinux_facts(:enforcing,{}) }
133
- it 'should return a hash' do
134
- expect( subject.class ).to eq Hash
135
- end
136
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
137
- subject { selinux_facts(:enforcing,{ :tmp_mount_dev_shm => 'rw,noatime'}) }
138
- it 'should have a :tmp_mount_dev_shm key' do
139
- expect( subject.key? :tmp_mount_dev_shm ).to be true
140
- end
141
- it ':tmp_mount_dev_shm should include "seclabel"' do
142
- expect( subject[:tmp_mount_dev_shm] ).to match /\bseclabel\b/
143
- end
144
- end
145
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
146
- subject { selinux_facts(:enforcing,{ :tmp_mount_dev_shm => 'rw,noatime,seclabel'}) }
147
- it ':tmp_mount_dev_shm should include "seclabel"' do
148
- expect( subject[:tmp_mount_dev_shm] ).to match /\bseclabel\b/
149
- end
150
- end
151
- end
152
-
153
- context 'When :permissive' do
154
- subject { selinux_facts(:permissive,{}) }
155
- it 'should return a hash' do
156
- expect( subject.class ).to eq Hash
157
- end
158
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
159
- subject { selinux_facts(:permissive,{ :tmp_mount_dev_shm => 'rw,noatime'}) }
160
- it 'should have a :tmp_mount_dev_shm key' do
161
- expect( subject.key? :tmp_mount_dev_shm ).to be true
162
- end
163
- it ':tmp_mount_dev_shm should include "seclabel"' do
164
- expect( subject[:tmp_mount_dev_shm] ).to match /\bseclabel\b/
165
- end
166
- end
167
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
168
- subject { selinux_facts(:permissive,{ :tmp_mount_dev_shm => 'rw,noatime,seclabel'}) }
169
- it ':tmp_mount_dev_shm should include "seclabel"' do
170
- expect( subject[:tmp_mount_dev_shm] ).to match /\bseclabel\b/
171
- end
172
- end
173
- end
174
-
175
- context 'When :disabled' do
176
- subject { selinux_facts(:disabled,{}) }
177
- it 'should return a hash' do
178
- expect( subject.class ).to eq Hash
179
- end
180
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime"`' do
181
- subject { selinux_facts(:disabled,{ :tmp_mount_dev_shm => 'rw,noatime'}) }
182
- it 'should have a :tmp_mount_dev_shm key' do
183
- expect( subject.key? :tmp_mount_dev_shm ).to be true
184
- end
185
- it ':tmp_mount_dev_shm should not include "seclabel"' do
186
- expect( subject[:tmp_mount_dev_shm] ).to_not match /\bseclabel\b/
187
- end
188
- end
189
- context 'when facts include `:tmp_mount_dev_shm => "rw,noatime,seclabel"`' do
190
- subject { selinux_facts(:disabled,{ :tmp_mount_dev_shm => 'rw,noatime,seclabel'}) }
191
- it ':tmp_mount_dev_shm should not include "seclabel"' do
192
- expect( subject[:tmp_mount_dev_shm] ).to_not match /\bseclabel\b/
193
- end
194
- end
195
- end
196
-
197
- end
198
- end