aboutsummaryrefslogtreecommitdiff
path: root/spec/classes
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2017-09-18 15:23:36 +0200
committerTim Meusel <tim@bastelfreak.de>2018-03-15 17:06:08 +0100
commit2d355a4c1baadc761d6b12645d0274da8866f722 (patch)
treee6d1a78f9719397ed9ce9144bf4706a3ccd46c48 /spec/classes
downloadpuppet-ferm-2d355a4c1baadc761d6b12645d0274da8866f722.tar.gz
puppet-ferm-2d355a4c1baadc761d6b12645d0274da8866f722.tar.bz2
initial commit
Diffstat (limited to 'spec/classes')
-rw-r--r--spec/classes/coverage_spec.rb4
-rw-r--r--spec/classes/ferm_spec.rb58
2 files changed, 62 insertions, 0 deletions
diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb
new file mode 100644
index 0000000..de44654
--- /dev/null
+++ b/spec/classes/coverage_spec.rb
@@ -0,0 +1,4 @@
+require 'rspec-puppet'
+
+at_exit { RSpec::Puppet::Coverage.report! }
+# vim: syntax=ruby
diff --git a/spec/classes/ferm_spec.rb b/spec/classes/ferm_spec.rb
new file mode 100644
index 0000000..e039c14
--- /dev/null
+++ b/spec/classes/ferm_spec.rb
@@ -0,0 +1,58 @@
+require 'spec_helper'
+
+describe 'ferm' do
+ let :node do
+ 'example.com'
+ end
+
+ on_supported_os.each do |os, facts|
+ context "on #{os} " do
+ let :facts do
+ facts
+ end
+
+ context 'with all defaults' do
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_class('ferm::config') }
+ it { is_expected.to contain_class('ferm::service') }
+ it { is_expected.to contain_class('ferm::install') }
+ it { is_expected.to contain_package('ferm') }
+ it { is_expected.to contain_file('/etc/ferm.d') }
+ it { is_expected.to contain_file('/etc/ferm.d/definitions') }
+ it { is_expected.to contain_file('/etc/ferm.d/chains') }
+ it { is_expected.not_to contain_service('ferm') }
+ it { is_expected.not_to contain_file('/etc/ferm.conf') }
+ end
+
+ context 'with managed service' do
+ let :params do
+ { manage_service: true }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_service('ferm') }
+ end
+ context 'with managed configfile' do
+ let :params do
+ { manage_configfile: true }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_concat('/etc/ferm.conf') }
+ it { is_expected.to contain_concat__fragment('ferm_header.conf') }
+ it { is_expected.to contain_concat__fragment('ferm.conf') }
+ end
+ context 'it creates chains' do
+ it { is_expected.to contain_concat__fragment('FORWARD-policy') }
+ it { is_expected.to contain_concat__fragment('INPUT-policy') }
+ it { is_expected.to contain_concat__fragment('OUTPUT-policy') }
+ it { is_expected.to contain_concat('/etc/ferm.d/chains/FORWARD.conf') }
+ it { is_expected.to contain_concat('/etc/ferm.d/chains/INPUT.conf') }
+ it { is_expected.to contain_concat('/etc/ferm.d/chains/OUTPUT.conf') }
+ it { is_expected.to contain_ferm__chain('FORWARD') }
+ it { is_expected.to contain_ferm__chain('OUTPUT') }
+ it { is_expected.to contain_ferm__chain('INPUT') }
+ end
+ end
+ end
+end