Test fixes that may prevent hanging problems during beaker tests.
authorJonathan Tripathy <jt@puppetlabs.com>
Fri, 3 Jul 2015 15:26:21 +0000 (16:26 +0100)
committerJonathan Tripathy <jt@puppetlabs.com>
Fri, 3 Jul 2015 15:48:45 +0000 (16:48 +0100)
spec/acceptance/connlimit_spec.rb

index bb049a9e04fa37536e96c088b6979f73d56d731a..5240208c23e8c44b55f174cd56ec11a2c874daed 100644 (file)
@@ -2,6 +2,15 @@ require 'spec_helper_acceptance'
 
 describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
 
+  describe 'reset' do
+    it 'deletes all iptables rules' do
+      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
+    end
+    it 'deletes all ip6tables rules' do
+      shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush')
+    end
+  end
+
   describe 'connlimit_above' do
     context '10' do
       it 'applies' do
@@ -9,8 +18,8 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
           class { '::firewall': }
           firewall { '500 - test':
             proto           => tcp,
-           dport           => '22',
-           connlimit_above => '10',
+            dport           => '2222',
+            connlimit_above => '10',
             action          => reject,
           }
         EOS
@@ -21,7 +30,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
       it 'should contain the rule' do
         shell('iptables-save') do |r|
           #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/)
+          expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 2222 -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
@@ -34,7 +43,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
           class { '::firewall': }
           firewall { '501 - test':
             proto           => tcp,
-            dport           => '22',
+            dport           => '2222',
             connlimit_above => '10',
             connlimit_mask  => '24',
             action          => reject,
@@ -47,7 +56,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
       it 'should contain the rule' do
         shell('iptables-save') do |r|
           #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/)
+          expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --dports 2222 -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