From: Peter Souter Date: Wed, 11 Mar 2015 18:06:43 +0000 (+0000) Subject: (MAINT) Adds an acceptance test for RHEL 7 X-Git-Tag: 1.5.0~4^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c2613de74c3805e2a8ff449531f3d8cb597f44c7;p=puppet-modules%2Fpuppetlabs-firewall.git (MAINT) Adds an acceptance test for RHEL 7 Lets us check the logic around making sure RHEL 7 changing service is working --- diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml new file mode 100644 index 0000000..f20fe44 --- /dev/null +++ b/spec/acceptance/nodesets/centos-7-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-7-x64: + roles: + - master + platform: el-7-x86_64 + box : puppetlabs/centos-7.0-64-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-7.0-64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss + log_level: verbose \ No newline at end of file diff --git a/spec/acceptance/rhel7_spec.rb b/spec/acceptance/rhel7_spec.rb new file mode 100644 index 0000000..5754ada --- /dev/null +++ b/spec/acceptance/rhel7_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'firewall on RHEL7', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) || !is_rhel7( !is_rhel7( fact('osfamily'), fact('operatingsystem'), fact('operatingsystemrelease') ) ) do + before :all do + iptables_flush_all_tables + end + + it 'should run successfully' do + pp = " + class { 'firewall': + remove_firewalld => true, + } + -> + resources { 'firewall': + purge => true, + } + -> + firewall { '555 - test': + proto => tcp, + port => '555', + action => accept, + } + " + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true, :debug => true) + expect(apply_manifest(pp, :catch_failures => true, :debug => true).exit_code).to be_zero + end + +end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index b9af876..28910a2 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -12,6 +12,21 @@ def ip6tables_flush_all_tables end end +def is_rhel7(osfamily, operatingsystem, operatingsystemrelease) + if osfamily == 'RedHat' + case operatingsystem + when 'Amazon' + false + when 'Fedora' + operatingsystemrelease >= '7.0' + else + operatingsystemrelease >= '15' + end + else + false + end +end + unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' # This will install the latest available package on el and deb based # systems fail on windows and osx, and install via gem on other *nixes