aboutsummaryrefslogtreecommitdiffstats
path: root/spec/classes/tripleo_selinux_spec.rb
diff options
context:
space:
mode:
authorAlex Schultz <aschultz@redhat.com>2016-09-21 13:41:58 -0600
committerAlex Schultz <aschultz@redhat.com>2016-09-21 17:34:55 -0600
commit223c88460baf33f62acd9d089351b61306e42d72 (patch)
tree0b152502f86e2c2f65cc07c267c0f208f958166d /spec/classes/tripleo_selinux_spec.rb
parentceccbfdd7b7a098741d79003f0741eee2a02df4d (diff)
Add in rspec-puppet-facts support
This change pulls in rspec-puppet-facts to provide the basic default facts for puppet-tripleo rspec tests. rspec-puppet-facts provides an easy to use interface to allow for the same set of tests to be executed with multiple sets of operating system facts. In most cases this includes defaults for Debian/RedHat based systems. In puppet-tripleo's case this is just RHEL/CentOS. We are removing the Fedora listing from the metadata.json as we only support RHEL and CentOS for tripleo. This change also updates the existing rspec tests to leverage rspec-puppet-facts to be more consistent with how facts are defined. Change-Id: I0ddc71799d74ee95b9828aea6a8dcb4abb4e4e62
Diffstat (limited to 'spec/classes/tripleo_selinux_spec.rb')
-rw-r--r--spec/classes/tripleo_selinux_spec.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/spec/classes/tripleo_selinux_spec.rb b/spec/classes/tripleo_selinux_spec.rb
index 301006b..f49f87b 100644
--- a/spec/classes/tripleo_selinux_spec.rb
+++ b/spec/classes/tripleo_selinux_spec.rb
@@ -19,11 +19,14 @@ require 'spec_helper'
describe 'tripleo::selinux' do
- shared_examples_for 'manage selinux' do
+ shared_examples_for 'tripleo::selinux' do
context 'with selinux enforcing' do
before :each do
- facts.merge!( :selinux_current_mode => 'enforcing' )
+ facts.merge!({
+ :selinux => true,
+ :selinux_current_mode => 'enforcing'
+ })
end
let :params do
@@ -55,7 +58,7 @@ describe 'tripleo::selinux' do
context 'with selinux disabled' do
before :each do
- facts.merge!( :selinux => 'false' )
+ facts.merge!({ :selinux => 'false' })
end
let :params do
@@ -89,18 +92,19 @@ describe 'tripleo::selinux' do
context 'on Debian platforms' do
let :facts do
- { :osfamily => 'Debian' }
+ { :osfamily => 'Debian' }
end
it_raises 'a Puppet::Error', /OS family unsuppored yet \(Debian\), SELinux support is only limited to RedHat family OS/
end
- context 'on RedHat platforms' do
- let :facts do
- { :osfamily => 'RedHat' }
- end
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
- it_configures 'manage selinux'
+ it_behaves_like 'tripleo::selinux'
+ end
end
-
end