From 44bc7216a4501da453eb4143773e42baeb870daf Mon Sep 17 00:00:00 2001 From: Bryan Jen Date: Thu, 11 Jun 2015 08:35:53 -0700 Subject: [PATCH] makes the acceptance tests more robust by ensuring selinux is disabled on all runs. Previously, selinux was disabled by the basic_spec acceptance tests, which set up the rest of the tests. However to make this more robust, we need to disable selinux from spec_helper_acceptance so that all runs get the disabling. --- spec/acceptance/basic_spec.rb | 12 ------------ spec/spec_helper_acceptance.rb | 7 +++++++ 2 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 spec/acceptance/basic_spec.rb diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb deleted file mode 100644 index 6c2b3f462..000000000 --- a/spec/acceptance/basic_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'disable selinux:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do - it "because otherwise apache won't work" do - apply_manifest(%{ - exec { "setenforce 0": - path => "/bin:/sbin:/usr/bin:/usr/sbin", - onlyif => "which setenforce && getenforce | grep Enforcing", - } - }, :catch_failures => true) - end -end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 4243cd2ca..e93465c9c 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -28,6 +28,13 @@ end on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','puppetlabs-concat', '--version 1.1.1', '--force'), { :acceptable_exit_codes => [0,1] } + + # Make sure selinux is disabled before each test or apache won't work. + if ! UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) + on host, puppet('apply', '-e', + %{"exec { 'setenforce 0': path => '/bin:/sbin:/usr/bin:/usr/sbin', onlyif => 'which setenforce && getenforce | grep Enforcing', }"}), + { :acceptable_exit_codes => [0] } + end end end end