From d665af40e1073f9813236ec911af5afdd6608862 Mon Sep 17 00:00:00 2001 From: Kilian Engelhardt Date: Wed, 3 Apr 2019 18:05:01 +0200 Subject: add test for RedHat-like to contain init script --- spec/classes/ferm_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/classes') diff --git a/spec/classes/ferm_spec.rb b/spec/classes/ferm_spec.rb index 0f9f854..aebcaae 100644 --- a/spec/classes/ferm_spec.rb +++ b/spec/classes/ferm_spec.rb @@ -22,6 +22,9 @@ describe 'ferm' do 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') } + if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i <= 6 + it { is_expected.not_to contain_file('/etc/init.d/ferm') } + end end context 'with managed service' do @@ -50,6 +53,17 @@ describe 'ferm' do it { is_expected.to contain_concat__fragment('ferm_header.conf') } it { is_expected.to contain_concat__fragment('ferm.conf') } end + context 'with managed initfile' do + let :params do + { manage_initfile: true } + end + + if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i <= 6 + it { is_expected.to contain_file('/etc/init.d/ferm') } + else + it { is_expected.not_to contain_file('/etc/init.d/ferm') } + end + end context 'it creates chains' do it { is_expected.to contain_concat__fragment('FORWARD-policy') } it { is_expected.to contain_concat__fragment('INPUT-policy') } -- cgit v1.2.3