From e266806f61bd437b93e39d28d95a09d67c4d6e1c Mon Sep 17 00:00:00 2001 From: adrianiurca Date: Mon, 1 Mar 2021 13:46:47 +0200 Subject: [PATCH] add extra configuration --- .../firewall_attributes_exceptions_spec.rb | 2 -- .../firewall_attributes_happy_path_spec.rb | 3 --- spec/acceptance/rules_spec.rb | 3 --- spec/spec_helper_acceptance_local.rb | 23 +++++++++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/spec/acceptance/firewall_attributes_exceptions_spec.rb b/spec/acceptance/firewall_attributes_exceptions_spec.rb index 67e59c2..b958915 100644 --- a/spec/acceptance/firewall_attributes_exceptions_spec.rb +++ b/spec/acceptance/firewall_attributes_exceptions_spec.rb @@ -6,8 +6,6 @@ describe 'firewall basics', docker: true do before :all do if os[:family] == 'ubuntu' || os[:family] == 'debian' update_profile_file - elsif os[:family] == 'redhat' - pre_setup end iptables_flush_all_tables ip6tables_flush_all_tables diff --git a/spec/acceptance/firewall_attributes_happy_path_spec.rb b/spec/acceptance/firewall_attributes_happy_path_spec.rb index dedc9be..65a73e9 100644 --- a/spec/acceptance/firewall_attributes_happy_path_spec.rb +++ b/spec/acceptance/firewall_attributes_happy_path_spec.rb @@ -4,9 +4,6 @@ require 'spec_helper_acceptance' describe 'firewall attribute testing, happy path' do before :all do - if os[:family] == 'redhat' - pre_setup - end iptables_flush_all_tables ip6tables_flush_all_tables end diff --git a/spec/acceptance/rules_spec.rb b/spec/acceptance/rules_spec.rb index 5b5dfeb..9a0c62e 100644 --- a/spec/acceptance/rules_spec.rb +++ b/spec/acceptance/rules_spec.rb @@ -6,9 +6,6 @@ require 'spec_helper_acceptance_local' describe 'rules spec' do describe 'complex ruleset 1' do before :all do - if os[:family] == 'redhat' - pre_setup - end iptables_flush_all_tables ip6tables_flush_all_tables end diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 461a9a8..b6a5417 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -22,11 +22,16 @@ end def install_iptables LitmusHelper.instance.run_shell('iptables -V') rescue - if os[:family] == 'redhat' - LitmusHelper.instance.run_shell('yum install iptables-services -y') - else - LitmusHelper.instance.run_shell('apt-get install iptables -y') - end + install_pp = <<-PUPPETCODE + $iptables_package_name = $facts['os']['family'] ? { + 'RedHat' => 'iptables-services', + default => 'iptables', + } + package { $iptables_package_name: + ensure => 'latest', + } + PUPPETCODE + LitmusHelper.instance.apply_manifest(install_pp) end def iptables_version @@ -55,7 +60,7 @@ RSpec.configure do |c| # To enable tests on abs/vmpooler machines just set to `true` this flag c.filter_run_excluding condition_parameter_test: false c.before :suite do - if fetch_os_name == 'centos' && os[:release].to_i == 8 + if os[:family] == 'redhat' pp = <<-PUPPETCODE package { 'iptables-services': ensure => 'latest', @@ -65,11 +70,15 @@ RSpec.configure do |c| } PUPPETCODE LitmusHelper.instance.apply_manifest(pp) + LitmusHelper.instance.run_shell('yum install system-config-firewall-base -y') + LitmusHelper.instance.run_shell('lokkit --default=server') + LitmusHelper.instance.run_shell('service ip6tables restart') + pre_setup end if os[:family] == 'debian' && os[:release].to_i == 10 pp = <<-PUPPETCODE package { 'net-tools': - ensure => 'latest', + ensure => 'latest', } PUPPETCODE LitmusHelper.instance.apply_manifest(pp) -- 2.45.2