aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThore Bödecker <thore.boedecker@godaddy.com>2019-07-10 16:37:50 +0200
committerTim Meusel <tim@bastelfreak.de>2019-09-02 11:19:00 +0200
commit859f8ba5cb553d66c9dcdbc232d17a0b641624df (patch)
treedf30502ab574dd029636662f8bf4b06bbe182b07 /spec
parentba10de286c634715931103031ad3bf20ce56ca14 (diff)
downloadpuppet-ferm-859f8ba5cb553d66c9dcdbc232d17a0b641624df.tar.gz
puppet-ferm-859f8ba5cb553d66c9dcdbc232d17a0b641624df.tar.bz2
allow preserving of chains in tables
Diffstat (limited to 'spec')
-rw-r--r--spec/classes/ferm_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/classes/ferm_spec.rb b/spec/classes/ferm_spec.rb
index 55e6739..e5669b8 100644
--- a/spec/classes/ferm_spec.rb
+++ b/spec/classes/ferm_spec.rb
@@ -59,6 +59,11 @@ describe 'ferm' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat__fragment('ferm_header.conf') }
it { is_expected.to contain_concat__fragment('ferm.conf') }
+ # the following string exists only if we preserve chains
+ it do
+ is_expected.to contain_concat__fragment('ferm.conf'). \
+ without_content(%r{@preserve;})
+ end
end
context 'with managed initfile' do
let :params do
@@ -88,6 +93,29 @@ describe 'ferm' do
it { is_expected.to contain_ferm__chain('OUTPUT') }
it { is_expected.to contain_ferm__chain('INPUT') }
end
+
+ context 'it preserves chains' do
+ let :params do
+ {
+ manage_configfile: true,
+ preserve_chains_in_tables: { 'nat' => %w[PREROUTING POSTROUTING] }
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it do
+ is_expected.to contain_concat__fragment('ferm.conf'). \
+ with_content(%r{domain \(ip ip6\) table nat \{})
+ end
+ it do
+ is_expected.to contain_concat__fragment('ferm.conf'). \
+ with_content(%r{chain PREROUTING @preserve;})
+ end
+ it do
+ is_expected.to contain_concat__fragment('ferm.conf'). \
+ with_content(%r{chain POSTROUTING @preserve;})
+ end
+ end
end
end
end