From c6b6ca3986cba3ca97b017898715dda9c6935d01 Mon Sep 17 00:00:00 2001 From: Jonathan Tripathy Date: Mon, 30 Mar 2015 17:04:14 +0100 Subject: [PATCH] Fix acceptance tests --- spec/acceptance/firewall_spec.rb | 89 +++++++++++++++++--------------- spec/acceptance/rhel7_spec.rb | 30 ----------- 2 files changed, 46 insertions(+), 73 deletions(-) delete mode 100644 spec/acceptance/rhel7_spec.rb diff --git a/spec/acceptance/firewall_spec.rb b/spec/acceptance/firewall_spec.rb index 331d831..8fadcad 100644 --- a/spec/acceptance/firewall_spec.rb +++ b/spec/acceptance/firewall_spec.rb @@ -833,57 +833,60 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami end end - describe 'checksum_fill' do - context 'virbr' do - it 'applies' do - pp = <<-EOS - class { '::firewall': } - firewall { '576 - test': - proto => udp, - table => 'mangle', - outiface => 'virbr0', - chain => 'POSTROUTING', - dport => '68', - jump => 'CHECKSUM', - checksum_fill => true, - provider => iptables, - } - EOS + + if default['platform'] !~ /el-5/ and default['platform'] !~ /ubuntu-10\.04/ and default['platform'] !~ /debian-6/ and default['platform'] !~ /sles/ + describe 'checksum_fill' do + context 'virbr' do + it 'applies' do + pp = <<-EOS + class { '::firewall': } + firewall { '576 - test': + proto => udp, + table => 'mangle', + outiface => 'virbr0', + chain => 'POSTROUTING', + dport => '68', + jump => 'CHECKSUM', + checksum_fill => true, + provider => iptables, + } + EOS - apply_manifest(pp, :catch_failures => true) - end + apply_manifest(pp, :catch_failures => true) + end - it 'should contain the rule' do - shell('iptables-save -t mangle') do |r| - expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + it 'should contain the rule' do + shell('iptables-save -t mangle') do |r| + expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + end end end end - end - describe 'checksum_fill6' do - context 'virbr' do - it 'applies' do - pp = <<-EOS - class { '::firewall': } - firewall { '576 - test': - proto => udp, - table => 'mangle', - outiface => 'virbr0', - chain => 'POSTROUTING', - dport => '68', - jump => 'CHECKSUM', - checksum_fill => true, - provider => ip6tables, - } - EOS + describe 'checksum_fill6' do + context 'virbr' do + it 'applies' do + pp = <<-EOS + class { '::firewall': } + firewall { '576 - test': + proto => udp, + table => 'mangle', + outiface => 'virbr0', + chain => 'POSTROUTING', + dport => '68', + jump => 'CHECKSUM', + checksum_fill => true, + provider => ip6tables, + } + EOS - apply_manifest(pp, :catch_failures => true) - end + apply_manifest(pp, :catch_failures => true) + end - it 'should contain the rule' do - shell('ip6tables-save -t mangle') do |r| - expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + it 'should contain the rule' do + shell('ip6tables-save -t mangle') do |r| + expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + end end end end diff --git a/spec/acceptance/rhel7_spec.rb b/spec/acceptance/rhel7_spec.rb deleted file mode 100644 index 5754ada..0000000 --- a/spec/acceptance/rhel7_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -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 -- 2.45.2