From: Ashley Penney Date: Mon, 5 May 2014 19:31:46 +0000 (+0200) Subject: Fix the tests to account for the changes in Ubuntu 14.04. X-Git-Tag: 1.1.0~3^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1581000cdcc901571b5f6e33da63ab479b820586;p=puppet-modules%2Fpuppetlabs-firewall.git Fix the tests to account for the changes in Ubuntu 14.04. --- diff --git a/spec/acceptance/connlimit_spec.rb b/spec/acceptance/connlimit_spec.rb index 3f0268f..ce6cab4 100644 --- a/spec/acceptance/connlimit_spec.rb +++ b/spec/acceptance/connlimit_spec.rb @@ -20,7 +20,8 @@ describe 'firewall type' do it 'should contain the rule' do shell('iptables-save') do |r| - expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 22 -m comment --comment "500 - test" -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable/) + #connlimit-saddr is added in Ubuntu 14.04. + expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 22 -m comment --comment "500 - test" -m connlimit --connlimit-above 10 --connlimit-mask 32 (--connlimit-saddr )?-j REJECT --reject-with icmp-port-unreachable/) end end end @@ -33,9 +34,9 @@ describe 'firewall type' do class { '::firewall': } firewall { '501 - test': proto => tcp, - dport => '22', - connlimit_above => '10', - connlimit_mask => '24', + dport => '22', + connlimit_above => '10', + connlimit_mask => '24', action => reject, } EOS @@ -45,7 +46,8 @@ describe 'firewall type' do it 'should contain the rule' do shell('iptables-save') do |r| - expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 22 -m comment --comment "501 - test" -m connlimit --connlimit-above 10 --connlimit-mask 24 -j REJECT --reject-with icmp-port-unreachable/) + #connlimit-saddr is added in Ubuntu 14.04. + expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 22 -m comment --comment "501 - test" -m connlimit --connlimit-above 10 --connlimit-mask 24 (--connlimit-saddr )?-j REJECT --reject-with icmp-port-unreachable/) end end end diff --git a/spec/acceptance/firewall_spec.rb b/spec/acceptance/firewall_spec.rb index 486ce56..5353e10 100644 --- a/spec/acceptance/firewall_spec.rb +++ b/spec/acceptance/firewall_spec.rb @@ -1524,7 +1524,8 @@ describe 'firewall type' do it 'should contain the rule' do shell('iptables-save') do |r| - expect(r.stdout).to match(/-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m comment --comment "597 - test" -m recent --set --name list1 --rdest/) + # Mask added as of Ubuntu 14.04. + expect(r.stdout).to match(/-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m comment --comment "597 - test" -m recent --set --name list1 (--mask 255.255.255.255 )?--rdest/) end end end @@ -1553,7 +1554,7 @@ describe 'firewall type' do it 'should contain the rule' do shell('iptables-save') do |r| - expect(r.stdout).to match(/-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m comment --comment "598 - test" -m recent --rcheck --seconds 60 --hitcount 5 --rttl --name list1 --rsource/) + expect(r.stdout).to match(/-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m comment --comment "598 - test" -m recent --rcheck --seconds 60 --hitcount 5 --rttl --name list1 (--mask 255.255.255.255 )?--rsource/) end end end diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..7e789c8 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-64 + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor : vagrant +CONFIG: + type: foss diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index a0e807c..ea0622a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -12,17 +12,13 @@ def ip6tables_flush_all_tables end end -unless ENV['RS_PROVISION'] == 'no' - hosts.each do |host| - # Install Puppet - if host.is_pe? - install_pe - else - install_package host, 'rubygems' - on host, 'gem install puppet --no-ri --no-rdoc' - on host, "mkdir -p #{host['distmoduledir']}" - end +unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' + if hosts.first.is_pe? + install_pe + else + install_puppet end + on hosts, "mkdir -p #{host['distmoduledir']}" end RSpec.configure do |c|