aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKilian Engelhardt <kilian.engelhardt@godaddy.com>2019-08-06 11:22:47 +0200
committerKilian Engelhardt <kilian.engelhardt@godaddy.com>2019-08-09 17:43:26 +0200
commitb1ba4a0ef369008996363c3cca15877cf8eb9fe5 (patch)
treeee53ab4cbadb9d949c2507751e1ee2a574702e8d /spec
parent1f8fe9481d7f12215661d4a0982810cd683f1ba9 (diff)
downloadpuppet-ferm-b1ba4a0ef369008996363c3cca15877cf8eb9fe5.tar.gz
puppet-ferm-b1ba4a0ef369008996363c3cca15877cf8eb9fe5.tar.bz2
add test for array support
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/rule_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb
index bd4ed73..53a11a4 100644
--- a/spec/defines/rule_spec.rb
+++ b/spec/defines/rule_spec.rb
@@ -40,6 +40,24 @@ describe 'ferm::rule', type: :define do
it { is_expected.to contain_concat__fragment('INPUT-eth0-aaa').with_content("interface eth0 {\n") }
it { is_expected.to contain_concat__fragment('INPUT-eth0-zzz').with_content("}\n") }
end
+ context 'with a specific interface using array for daddr' do
+ let(:title) { 'filter-ssh' }
+ let :params do
+ {
+ chain: 'INPUT',
+ policy: 'ACCEPT',
+ proto: 'tcp',
+ dport: '22',
+ daddr: ['127.0.0.1', '123.123.123.123', ['10.0.0.1', '10.0.0.2']],
+ interface: 'eth0'
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_concat__fragment('INPUT-eth0-filter-ssh').with_content(" mod comment comment 'filter-ssh' proto tcp dport 22 daddr @ipfilter(127.0.0.1 123.123.123.123 10.0.0.1 10.0.0.2) ACCEPT;\n") }
+ it { is_expected.to contain_concat__fragment('INPUT-eth0-aaa').with_content("interface eth0 {\n") }
+ it { is_expected.to contain_concat__fragment('INPUT-eth0-zzz').with_content("}\n") }
+ end
end
end
end