diff options
author | Tim Meusel <tim@bastelfreak.de> | 2021-10-31 19:00:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-31 19:00:59 +0100 |
commit | cb55a971350d32c52cdc49b947f08a815d90ac2a (patch) | |
tree | e69eae8647045ab14a59cfaaf99195770b5f7fd3 /spec/defines | |
parent | 4f2879e76556a7bc3f43fdd329fae05a46143e21 (diff) | |
parent | db73699faa6804744edc06924c43873ebb6f2932 (diff) | |
download | puppet-ferm-cb55a971350d32c52cdc49b947f08a815d90ac2a.tar.gz puppet-ferm-cb55a971350d32c52cdc49b947f08a815d90ac2a.tar.bz2 |
Merge pull request #142 from voxpupuli/modulesync
modulesync 5.0.0
Diffstat (limited to 'spec/defines')
-rw-r--r-- | spec/defines/chain_spec.rb | 29 | ||||
-rw-r--r-- | spec/defines/ipset_spec.rb | 4 | ||||
-rw-r--r-- | spec/defines/rule_spec.rb | 9 |
3 files changed, 30 insertions, 12 deletions
diff --git a/spec/defines/chain_spec.rb b/spec/defines/chain_spec.rb index 52cc88c..5e84ea5 100644 --- a/spec/defines/chain_spec.rb +++ b/spec/defines/chain_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ferm::chain', type: :define do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end @@ -22,14 +24,17 @@ describe 'ferm::chain', type: :define do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_concat__fragment('filter-INPUT2-config-include') } + it do - is_expected.to contain_concat__fragment('filter-INPUT2-policy'). \ + expect(subject).to contain_concat__fragment('filter-INPUT2-policy'). \ with_content(%r{ESTABLISHED RELATED}) end + it do - is_expected.to contain_concat__fragment('filter-INPUT2-footer'). \ + expect(subject).to contain_concat__fragment('filter-INPUT2-footer'). \ with_content(%r{LOG log-prefix 'INPUT2: ';}) end + if facts[:os]['name'] == 'Debian' it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-INPUT2.conf') } else @@ -47,13 +52,15 @@ describe 'ferm::chain', type: :define do end it { is_expected.to compile.with_all_deps } + it do - is_expected.to contain_concat__fragment('filter-INPUT2-policy') - is_expected.not_to contain_concat__fragment('filter-INPUT2-policy'). \ + expect(subject).to contain_concat__fragment('filter-INPUT2-policy') + expect(subject).not_to contain_concat__fragment('filter-INPUT2-policy'). \ with_content(%r{ESTABLISHED RELATED}) end + it do - is_expected.not_to contain_concat__fragment('filter-INPUT2-footer'). \ + expect(subject).not_to contain_concat__fragment('filter-INPUT2-footer'). \ with_content(%r{LOG log-prefix 'INPUT2: ';}) end end @@ -81,16 +88,20 @@ describe 'ferm::chain', type: :define do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_concat__fragment('filter-FERM-DSL-config-include') } + it do - is_expected.to contain_concat__fragment('filter-FERM-DSL-custom-content'). \ + expect(subject).to contain_concat__fragment('filter-FERM-DSL-custom-content'). \ with_content(%r{mod rpfilter invert DROP;}) end + it do - is_expected.not_to contain_concat__fragment('filter-FERM-DSL-policy') + expect(subject).not_to contain_concat__fragment('filter-FERM-DSL-policy') end + it do - is_expected.not_to contain_concat__fragment('filter-FERM-DSL-footer') + expect(subject).not_to contain_concat__fragment('filter-FERM-DSL-footer') end + if facts[:os]['name'] == 'Debian' it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-FERM-DSL.conf') } else diff --git a/spec/defines/ipset_spec.rb b/spec/defines/ipset_spec.rb index 050e5ef..88ef5c3 100644 --- a/spec/defines/ipset_spec.rb +++ b/spec/defines/ipset_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ferm::ipset', type: :define do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb index 7529fce..4b7b1d4 100644 --- a/spec/defines/rule_spec.rb +++ b/spec/defines/rule_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ferm::rule', type: :define do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end @@ -202,12 +204,15 @@ describe 'ferm::rule', type: :define do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_concat__fragment('filter-SSH-policy') } + it do - is_expected.to contain_concat__fragment('INPUT-filter-ssh').\ + expect(subject).to contain_concat__fragment('INPUT-filter-ssh').\ with_content("mod comment comment 'filter-ssh' proto tcp dport 22 jump SSH;\n"). \ that_requires('Ferm::Chain[check-ssh]') end + it { is_expected.to contain_concat__fragment('filter-INPUT-config-include') } + if facts[:os]['name'] == 'Debian' it { is_expected.to contain_concat('/etc/ferm/ferm.d/chains/filter-SSH.conf') } else |