aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThore Bödecker <me@foxxx0.de>2019-09-11 16:01:32 +0200
committerThore Bödecker <me@foxxx0.de>2019-09-11 16:01:32 +0200
commit3d868fb81532d717fd625638781e4663a834260c (patch)
tree397bcfd1f98200da896b8d032cbd4b9bcb1a3749 /spec
parent6d96e030be0db4a916dd6a9bd0b25570d359e634 (diff)
downloadpuppet-ferm-3d868fb81532d717fd625638781e4663a834260c.tar.gz
puppet-ferm-3d868fb81532d717fd625638781e4663a834260c.tar.bz2
allow using an array for $proto
This enables defining ferm::rule with multiple protocols at once, because using 'all' for $proto does not allow using $dport/$sport.
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/rule_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb
index ef20e17..33ce169 100644
--- a/spec/defines/rule_spec.rb
+++ b/spec/defines/rule_spec.rb
@@ -114,6 +114,25 @@ describe 'ferm::rule', type: :define do
it { is_expected.to contain_concat__fragment('INPUT-eth0-zzz').with_content("}\n") }
end
+ context 'without a specific interface using array for proto' do
+ let(:title) { 'filter-consul' }
+ let :params do
+ {
+ chain: 'INPUT',
+ action: 'ACCEPT',
+ proto: %w[tcp udp],
+ dport: '(8301 8302)',
+ saddr: '127.0.0.1'
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_concat__fragment('INPUT-filter-consul').with_content("mod comment comment 'filter-consul' proto (tcp udp) dport (8301 8302) saddr @ipfilter((127.0.0.1)) ACCEPT;\n") }
+ it { is_expected.to contain_concat__fragment('filter-INPUT-config-include') }
+ it { is_expected.to contain_concat__fragment('filter-FORWARD-config-include') }
+ it { is_expected.to contain_concat__fragment('filter-OUTPUT-config-include') }
+ end
+
context 'with jumping to custom chains' do
# create custom chain
let(:pre_condition) do