]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix the tests to account for the changes in Ubuntu 14.04.
authorAshley Penney <ashley.penney@puppetlabs.com>
Mon, 5 May 2014 19:31:46 +0000 (21:31 +0200)
committerAshley Penney <ashley.penney@puppetlabs.com>
Tue, 6 May 2014 18:10:26 +0000 (20:10 +0200)
spec/acceptance/connlimit_spec.rb
spec/acceptance/firewall_spec.rb
spec/acceptance/nodesets/ubuntu-server-1404-x64.yml [new file with mode: 0644]
spec/spec_helper_acceptance.rb

index 3f0268f1d6b788d94369478b65c05027e6a598e0..ce6cab4ed72f2954b2d46329a26fab5bcdd7806b 100644 (file)
@@ -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
index 486ce569430ce6e9f24eeb5338d5d4c37108bb90..5353e104d59db811a847f5410cd48a0f21f65f7a 100644 (file)
@@ -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 (file)
index 0000000..7e789c8
--- /dev/null
@@ -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
index a0e807c54e7423094cc3bc442383d3858619d9b2..ea0622a25aff9eecce394ea92f7a7828adc61a11 100644 (file)
@@ -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|