]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Add rspec-system tests for src_range/dst_range
authorHunter Haugen <h.haugen@gmail.com>
Tue, 9 Jul 2013 00:05:58 +0000 (17:05 -0700)
committerHunter Haugen <h.haugen@gmail.com>
Tue, 9 Jul 2013 21:19:44 +0000 (14:19 -0700)
spec/system/params_spec.rb

index 7236d652bb15b9c019ea9c7b49d8c18d65859fdc..497a042b55618a62b09d90cb95463978dc18ddb0 100644 (file)
@@ -124,4 +124,43 @@ firewall { '#{name}':
       r.exit_code.should be_zero
     end
   end
+
+  it 'test src_range rule' do
+    iptables_flush_all_tables
+
+    ppm = pp({
+      'name'      => '997 block src ip range',
+      'chain'     => 'INPUT',
+      'proto'     => 'all',
+      'action'    => 'drop',
+      'src_range' => '"10.0.0.1-10.0.0.10"',
+    })
+    puppet_apply(ppm) do |r|
+      r.exit_code.should == 2
+      r.stderr.should be_empty
+      r.refresh
+      r.stderr.should be_empty
+      r.exit_code.should be_zero
+    end
+  end
+
+  it 'test dst_range rule' do
+    iptables_flush_all_tables
+
+    ppm = pp({
+      'name'      => '998 block dst ip range',
+      'chain'     => 'INPUT',
+      'proto'     => 'all',
+      'action'    => 'drop',
+      'dst_range' => '"10.0.0.2-10.0.0.20"',
+    })
+    puppet_apply(ppm) do |r|
+      r.exit_code.should == 2
+      r.stderr.should be_empty
+      r.refresh
+      r.stderr.should be_empty
+      r.exit_code.should be_zero
+    end
+  end
+
 end