From 760a09221ce05aebadb7ccaab6c75d6640ca4b42 Mon Sep 17 00:00:00 2001 From: Dan Carley Date: Thu, 13 Jun 2013 21:10:04 +0100 Subject: [PATCH] [#200] Add tests for --limit-burst Both explicit (when a `:burst` parameter or `--limit-burst` argument is present) and implicit (when neither are specified but `:limit` or `--limit` are present and the default burst is `5`). --- spec/fixtures/iptables/conversion_hash.rb | 26 ++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/spec/fixtures/iptables/conversion_hash.rb b/spec/fixtures/iptables/conversion_hash.rb index 870a978..2f30e5e 100644 --- a/spec/fixtures/iptables/conversion_hash.rb +++ b/spec/fixtures/iptables/conversion_hash.rb @@ -167,12 +167,22 @@ ARGS_TO_HASH = { :jump => 'LOG' }, }, - 'load_limit_module' => { + 'load_limit_module_and_implicit_burst' => { :line => '-A INPUT -m multiport --dports 123 -m comment --comment "057 INPUT limit NTP" -m limit --limit 15/hour', :table => 'filter', :params => { :dport => ['123'], - :limit => '15/hour' + :limit => '15/hour', + :burst => '5' + }, + }, + 'limit_with_explicit_burst' => { + :line => '-A INPUT -m multiport --dports 123 -m comment --comment "057 INPUT limit NTP" -m limit --limit 30/hour --limit-burst 10', + :table => 'filter', + :params => { + :dport => ['123'], + :limit => '30/hour', + :burst => '10' }, }, 'proto_ipencap' => { @@ -533,7 +543,7 @@ HASH_TO_ARGS = { }, :args => ['-t', :filter, '-p', :tcp, '-m', 'comment', '--comment', '956 INPUT log-level', '-m', 'state', '--state', 'NEW', '-j', 'LOG', '--log-level', '4'], }, - 'load_limit_module' => { + 'load_limit_module_and_implicit_burst' => { :params => { :name => '057 INPUT limit NTP', :table => 'filter', @@ -542,6 +552,16 @@ HASH_TO_ARGS = { }, :args => ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--dports', '123', '-m', 'comment', '--comment', '057 INPUT limit NTP', '-m', 'limit', '--limit', '15/hour'], }, + 'limit_with_explicit_burst' => { + :params => { + :name => '057 INPUT limit NTP', + :table => 'filter', + :dport => '123', + :limit => '30/hour', + :burst => '10' + }, + :args => ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--dports', '123', '-m', 'comment', '--comment', '057 INPUT limit NTP', '-m', 'limit', '--limit', '30/hour', '--limit-burst', '10'], + }, 'proto_ipencap' => { :params => { :name => '0100 INPUT accept ipencap', -- 2.45.2