aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2019-05-30 18:45:51 +0200
committerTim Meusel <tim@bastelfreak.de>2019-07-11 15:10:40 +0200
commit4f7b544f57fede1dd046c25d2c8f9270c5dbd8ba (patch)
treeca013d4134646b9758cd38707b7fe297c8fd186a /spec
parente3da2ce3255f1833dcd194370cb99b4d5c9448c9 (diff)
downloadpuppet-ferm-4f7b544f57fede1dd046c25d2c8f9270c5dbd8ba.tar.gz
puppet-ferm-4f7b544f57fede1dd046c25d2c8f9270c5dbd8ba.tar.bz2
add support for interface specific rules
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/rule_spec.rb42
1 files changed, 30 insertions, 12 deletions
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb
index 0473970..bd4ed73 100644
--- a/spec/defines/rule_spec.rb
+++ b/spec/defines/rule_spec.rb
@@ -6,21 +6,39 @@ describe 'ferm::rule', type: :define do
let :facts do
facts
end
- let(:title) { 'filter-ssh' }
- let :params do
- {
- chain: 'INPUT',
- policy: 'ACCEPT',
- proto: 'tcp',
- dport: '22',
- saddr: '127.0.0.1'
- }
- end
- context 'default params create simple rule' do
+ context 'without a specific interface' do
+ let(:title) { 'filter-ssh' }
+ let :params do
+ {
+ chain: 'INPUT',
+ policy: 'ACCEPT',
+ proto: 'tcp',
+ dport: '22',
+ saddr: '127.0.0.1'
+ }
+ 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') }
+ end
+ context 'with a specific interface' do
+ let(:title) { 'filter-ssh' }
+ let :params do
+ {
+ chain: 'INPUT',
+ policy: 'ACCEPT',
+ proto: 'tcp',
+ dport: '22',
+ saddr: '127.0.0.1',
+ 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 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
end
end