Skip to content

Commit 89e8471

Browse files
author
Morgan Haskel
committed
Merge pull request #448 from cmurphy/fix_tests
Fix netmap acceptance tests
2 parents dc3bd7f + 847d513 commit 89e8471

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/puppet/provider/firewall/iptables.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def self.rule_to_hash(line, table, counter)
267267
map_index={}
268268
@resource_map.each_pair do |map_k,map_v|
269269
[map_v].flatten.each do |v|
270-
ind=values.index(/\s#{v}/)
270+
ind=values.index(/\s#{v}\s/)
271271
next unless ind
272272
map_index[map_k]=ind
273273
end

spec/acceptance/firewall_spec.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,11 +1701,18 @@ class { '::firewall': }
17011701

17021702
it 'should contain the rule' do
17031703
shell('iptables-save -t nat') do |r|
1704-
expect(r.stdout).to match(/-A PREROUTING -s 200.200.200.200(\/32)? -p tcp -m comment --comment "611 - test" -j NETMAP --to 192.168.1.1/)
1704+
expect(r.stdout).to match(/-A PREROUTING -s 200.200.200.200(\/32)? -p tcp -m comment --comment "569 - test" -j NETMAP --to 192.168.1.1/)
17051705
end
17061706
end
17071707
end
17081708

1709+
describe 'reset' do
1710+
it 'deletes all rules' do
1711+
shell('ip6tables --flush')
1712+
shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
1713+
end
1714+
end
1715+
17091716
context 'Source netmap 192.168.1.1' do
17101717
it 'applies' do
17111718
pp = <<-EOS
@@ -1725,7 +1732,7 @@ class { '::firewall': }
17251732

17261733
it 'should contain the rule' do
17271734
shell('iptables-save -t nat') do |r|
1728-
expect(r.stdout).to match(/-A POSTROUTING -d 200.200.200.200(\/32)? -p tcp -m comment --comment "611 - test" -j NETMAP --to 192.168.1.1/)
1735+
expect(r.stdout).to match(/-A POSTROUTING -d 200.200.200.200(\/32)? -p tcp -m comment --comment "569 - test" -j NETMAP --to 192.168.1.1/)
17291736
end
17301737
end
17311738
end

0 commit comments

Comments
 (0)