diff options
author | Tim Meusel <tim@bastelfreak.de> | 2019-08-12 22:55:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-12 22:55:52 +0200 |
commit | 15153bd994f4715d37b398264581914692a93c45 (patch) | |
tree | 46a981008420953c768e23c05ca340497b1f3d59 /spec/defines/rule_spec.rb | |
parent | 5eee9cc90593623c8936cf5ee9da2e4ce8c5fa6e (diff) | |
parent | a0d72d5947030fc2dc4332652e5868fa15b906e4 (diff) | |
download | puppet-ferm-15153bd994f4715d37b398264581914692a93c45.tar.gz puppet-ferm-15153bd994f4715d37b398264581914692a93c45.tar.bz2 |
Merge pull request #51 from kBite/allow-array-for-saddr-daddr
Allow array for saddr and daddr
Diffstat (limited to 'spec/defines/rule_spec.rb')
-rw-r--r-- | spec/defines/rule_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb index bd4ed73..3ee5576 100644 --- a/spec/defines/rule_spec.rb +++ b/spec/defines/rule_spec.rb @@ -20,7 +20,7 @@ describe 'ferm::rule', type: :define do end it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_concat__fragment('INPUT-filter-ssh').with_content("mod comment comment 'filter-ssh' proto tcp dport 22 saddr @ipfilter(127.0.0.1) ACCEPT;\n") } + it { is_expected.to contain_concat__fragment('INPUT-filter-ssh').with_content("mod comment comment 'filter-ssh' proto tcp dport 22 saddr @ipfilter((127.0.0.1)) ACCEPT;\n") } end context 'with a specific interface' do let(:title) { 'filter-ssh' } @@ -36,7 +36,25 @@ describe 'ferm::rule', type: :define do 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 saddr @ipfilter(127.0.0.1) ACCEPT;\n") } + it { is_expected.to contain_concat__fragment('INPUT-eth0-filter-ssh').with_content(" mod comment comment 'filter-ssh' proto tcp dport 22 saddr @ipfilter((127.0.0.1)) 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 + 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 |