aboutsummaryrefslogtreecommitdiff
path: root/spec/defines
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/defines
downloadpuppet-ferm-2d355a4c1baadc761d6b12645d0274da8866f722.tar.gz
puppet-ferm-2d355a4c1baadc761d6b12645d0274da8866f722.tar.bz2
initial commit
Diffstat (limited to 'spec/defines')
-rw-r--r--spec/defines/chain_spec.rb20
-rw-r--r--spec/defines/rule_spec.rb27
2 files changed, 47 insertions, 0 deletions
diff --git a/spec/defines/chain_spec.rb b/spec/defines/chain_spec.rb
new file mode 100644
index 0000000..110f1d0
--- /dev/null
+++ b/spec/defines/chain_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe 'ferm::chain', type: :define do
+ on_supported_os.each do |os, facts|
+ context "on #{os} " do
+ let :facts do
+ facts
+ end
+ let(:title) { 'INPUT' }
+ let(:params) { { policy: 'DROP' } }
+
+ context 'default params creates INPUT chain' do
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_concat__fragment('INPUT-policy') }
+ it { is_expected.to contain_concat('/etc/ferm.d/chains/INPUT.conf') }
+ it { is_expected.to contain_ferm__chain('INPUT') }
+ end
+ end
+ end
+end
diff --git a/spec/defines/rule_spec.rb b/spec/defines/rule_spec.rb
new file mode 100644
index 0000000..0926432
--- /dev/null
+++ b/spec/defines/rule_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe 'ferm::rule', type: :define do
+ on_supported_os.each do |os, facts|
+ context "on #{os} " 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
+ it { is_expected.to compile.with_all_deps }
+ # it { is_expected.to contain_concat__fragment('INPUT-filter-ssh').with_content("proto tcp dport ssh saddr @ipfilter(127.0.0.1) ACCEPT;") }
+ it { is_expected.to contain_concat__fragment('INPUT-filter-ssh') }
+ end
+ end
+ end
+end