-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use rspec-puppet-facts in all places
Facts for supported OSes are now loaded from the rspec-puppet-facts. Commit includes no changes to any test, they all just ran as in on top of the various os facts.
- Loading branch information
1 parent
a58704b
commit eb0b708
Showing
15 changed files
with
416 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
--- | ||
.travis.yml: | ||
secure: "r7NI3OHbyMs/w351LkmkTFFLriDDyWKvgyZt+XYPw7jbaWmqnV4+NSJMQSkXgTS+tq2jNPLOWY1UuPuFJKkyd1m7LteOb2yZ6HJs5BL7QJjJWC2vUjkY60kl2xHn81D6SEXOXoVseGWiimlTlWJM3pKljNgZOZlOMw96vgnd6/I=" | ||
spec/spec_helper.rb: | ||
spec_overrides: "require 'spec_helper_methods'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,56 @@ | ||
require 'spec_helper' | ||
|
||
describe 'selinux' do | ||
include_context 'RedHat 7' | ||
|
||
context 'config' do | ||
context 'invalid mode' do | ||
let(:params) { { mode: 'invalid' } } | ||
it { expect { is_expected.to create_class('selinux') }.to raise_error(%r{Valid modes are enforcing, permissive, and disabled. Received: invalid}) } | ||
end | ||
|
||
context 'undef mode' do | ||
it { is_expected.to have_file_resource_count(1) } | ||
it { is_expected.to have_file_line_resource_count(0) } | ||
it { is_expected.to have_exec_resource_count(0) } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-enforcing') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-permissive') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-disabled') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-enforcing') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-permissive') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-disabled') } | ||
end | ||
|
||
context 'enforcing' do | ||
let(:params) { { mode: 'enforcing' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-enforcing').with(line: 'SELINUX=enforcing') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-enforcing').with(command: 'setenforce 1') } | ||
end | ||
|
||
context 'permissive' do | ||
let(:params) { { mode: 'permissive' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-permissive').with(line: 'SELINUX=permissive') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-permissive').with(command: 'setenforce 0') } | ||
end | ||
|
||
context 'disabled' do | ||
let(:params) { { mode: 'disabled' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-disabled').with(line: 'SELINUX=disabled') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-disabled').with(command: 'setenforce 0') } | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
|
||
context 'config' do | ||
context 'invalid mode' do | ||
let(:params) { { mode: 'invalid' } } | ||
it { expect { is_expected.to create_class('selinux') }.to raise_error(%r{Valid modes are enforcing, permissive, and disabled. Received: invalid}) } | ||
end | ||
|
||
context 'undef mode' do | ||
it { is_expected.to have_file_resource_count(1) } | ||
it { is_expected.to have_file_line_resource_count(0) } | ||
it { is_expected.to have_exec_resource_count(0) } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-enforcing') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-permissive') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-to-disabled') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-enforcing') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-permissive') } | ||
it { is_expected.not_to contain_exec('change-selinux-status-to-disabled') } | ||
end | ||
|
||
context 'enforcing' do | ||
let(:params) { { mode: 'enforcing' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-enforcing').with(line: 'SELINUX=enforcing') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-enforcing').with(command: 'setenforce 1') } | ||
end | ||
|
||
context 'permissive' do | ||
let(:params) { { mode: 'permissive' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-permissive').with(line: 'SELINUX=permissive') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-permissive').with(command: 'setenforce 0') } | ||
end | ||
|
||
context 'disabled' do | ||
let(:params) { { mode: 'disabled' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-to-disabled').with(line: 'SELINUX=disabled') } | ||
it { is_expected.to contain_exec('change-selinux-status-to-disabled').with(command: 'setenforce 0') } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,51 @@ | ||
require 'spec_helper' | ||
|
||
describe 'selinux' do | ||
include_context 'RedHat 7' | ||
|
||
context 'config' do | ||
context 'invalid type' do | ||
let(:params) { { type: 'invalid' } } | ||
it { expect { is_expected.to create_class('selinux') }.to raise_error(%r{Valid types are targeted, minimum, and mls. Received: invalid}) } | ||
end | ||
|
||
context 'undef type' do | ||
it { is_expected.to have_file_resource_count(1) } | ||
it { is_expected.to have_file_line_resource_count(0) } | ||
it { is_expected.to have_exec_resource_count(0) } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-targeted') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-minimum') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-mls') } | ||
end | ||
|
||
context 'targeted' do | ||
let(:params) { { type: 'targeted' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-targeted').with(line: 'SELINUXTYPE=targeted') } | ||
end | ||
|
||
context 'minimum' do | ||
let(:params) { { type: 'minimum' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-minimum').with(line: 'SELINUXTYPE=minimum') } | ||
end | ||
|
||
context 'mls' do | ||
let(:params) { { type: 'mls' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-mls').with(line: 'SELINUXTYPE=mls') } | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
context 'config' do | ||
context 'invalid type' do | ||
let(:params) { { type: 'invalid' } } | ||
it { expect { is_expected.to create_class('selinux') }.to raise_error(%r{Valid types are targeted, minimum, and mls. Received: invalid}) } | ||
end | ||
|
||
context 'undef type' do | ||
it { is_expected.to have_file_resource_count(1) } | ||
it { is_expected.to have_file_line_resource_count(0) } | ||
it { is_expected.to have_exec_resource_count(0) } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-targeted') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-minimum') } | ||
it { is_expected.not_to contain_file_line('set-selinux-config-type-to-mls') } | ||
end | ||
|
||
context 'targeted' do | ||
let(:params) { { type: 'targeted' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-targeted').with(line: 'SELINUXTYPE=targeted') } | ||
end | ||
|
||
context 'minimum' do | ||
let(:params) { { type: 'minimum' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-minimum').with(line: 'SELINUXTYPE=minimum') } | ||
end | ||
|
||
context 'mls' do | ||
let(:params) { { type: 'mls' } } | ||
|
||
it { is_expected.to contain_file('/usr/share/selinux').with(ensure: 'directory') } | ||
it { is_expected.to contain_file_line('set-selinux-config-type-to-mls').with(line: 'SELINUXTYPE=mls') } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
require 'spec_helper' | ||
|
||
describe 'selinux::restorecond' do | ||
include_context 'RedHat 7' | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
|
||
it { is_expected.to contain_concat('/etc/selinux/restorecond.conf') } | ||
it { is_expected.to contain_concat__fragment('restorecond_config_default') } | ||
it { is_expected.to contain_concat('/etc/selinux/restorecond.conf') } | ||
it { is_expected.to contain_concat__fragment('restorecond_config_default') } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
require 'spec_helper' | ||
|
||
describe 'selinux::restorecond' do | ||
include_context 'RedHat 7' | ||
|
||
it { is_expected.to contain_service('restorecond') } | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
it { is_expected.to contain_service('restorecond') } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
describe 'selinux::restorecond' do | ||
include_context 'RedHat 7' | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
|
||
it { is_expected.to contain_class('selinux::restorecond') } | ||
it { is_expected.to contain_class('selinux::restorecond::config') } | ||
it { is_expected.to contain_class('selinux::restorecond::service') } | ||
it { is_expected.to contain_class('selinux::restorecond') } | ||
it { is_expected.to contain_class('selinux::restorecond::config') } | ||
it { is_expected.to contain_class('selinux::restorecond::service') } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.