]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(MODULES-48) Parse negated rules
authorHunter Haugen <hunter@puppetlabs.com>
Wed, 5 Feb 2014 22:38:16 +0000 (14:38 -0800)
committerHunter Haugen <hunter@puppetlabs.com>
Wed, 5 Feb 2014 22:42:44 +0000 (14:42 -0800)
This adds tests mentioned in #141 and MODULES-48 to make sure that they
are covered by #267

Closes #141

spec/acceptance/resource_cmd_spec.rb

index f67c300557c8d435e402db9aef24b53e1b7944b9..575fa8c8631a3b7d380365f25841fdbadf3aab18 100644 (file)
@@ -58,4 +58,21 @@ describe 'puppet resource firewall command:' do
       end
     end
   end
+
+  context 'accepts rules with negation' do
+    before :all do
+      iptables_flush_all_tables
+      shell('/sbin/iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535')
+      shell('/sbin/iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp -j MASQUERADE --to-ports 1024-65535')
+      shell('/sbin/iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE')
+    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
 end