]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Added unit tests
authorDaniel Selans <daniel@cloudsy.com>
Thu, 12 Jun 2014 02:57:04 +0000 (22:57 -0400)
committerHunter Haugen <hunter@puppetlabs.com>
Wed, 20 Aug 2014 22:52:21 +0000 (15:52 -0700)
spec/acceptance/resource_cmd_spec.rb

index 82b5e54cea3ffb0874acb1c7da2ac69277254b18..b942c5580ca10453bfe7917b2f73d06fc0cf779c 100644 (file)
@@ -90,6 +90,23 @@ describe 'puppet resource firewall command:', :unless => UNSUPPORTED_PLATFORMS.i
     end
   end
 
+  context 'accepts rules utilizing the statistic module' do
+    before :all do
+      iptables_flush_all_tables
+      shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 2 -j SNAT --to-source 2.3.4.5')
+      shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 1 --packet 0 -j SNAT --to-source 2.3.4.6')
+      shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode random --probability 0.99 -j SNAT --to-source 2.3.4.7')
+    end
+
+    it do
+      shell('puppet resource firewall') do |r|
+        r.exit_code.should be_zero
+        # don't check stdout, testing preexisting rules, output is normal
+        r.stderr.should be_empty
+      end
+    end
+  end
+
   context 'accepts rules with negation' do
     before :all do
       iptables_flush_all_tables