From 9362dc06dd92a28fb058c7f4440ad8ee23de2306 Mon Sep 17 00:00:00 2001 From: tphoney <tp@puppet.com> Date: Tue, 19 Feb 2019 15:37:42 +0000 Subject: [PATCH] remove unused test, simplify os logic --- spec/acceptance/firewall_clusterip_spec.rb | 48 ---------------------- spec/acceptance/firewall_spec.rb | 30 +++++--------- spec/acceptance/resource_cmd_spec.rb | 3 +- 3 files changed, 11 insertions(+), 70 deletions(-) delete mode 100644 spec/acceptance/firewall_clusterip_spec.rb diff --git a/spec/acceptance/firewall_clusterip_spec.rb b/spec/acceptance/firewall_clusterip_spec.rb deleted file mode 100644 index a3c71ce..0000000 --- a/spec/acceptance/firewall_clusterip_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ - -# These tests have been commented out, as there are suspicions that the clusterIP ipt module is causing system reboots. - -# require 'spec_helper_acceptance' - -# describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do - -# before(:all) do -# shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush') -# shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush') -# end - -# # SLES doesn't have the CLUSTERIP module -# if default['platform'] !~ /sles/ -# describe 'clusterip' do -# context 'cluster ipv4 test' do -# it 'applies' do -# pending("MODULES-2124 should be resolved for clusterip RHEL7 support") if default['platform'] =~ /el-7/ -# pp = <<-EOS -# class { '::firewall': } -# firewall { -# '830 - clusterip test': -# chain => 'FORWARD', -# jump => 'CLUSTERIP', -# destination => '1.1.1.1', -# iniface => 'eth0', -# clusterip_new => true, -# clusterip_hashmode => "sourceip", -# clusterip_clustermac => "01:00:5E:00:00:00", -# clusterip_total_nodes => "2", -# clusterip_local_node => "1", -# clusterip_hash_init => "1337", -# } -# EOS - -# apply_manifest(pp, :catch_failures => true) -# end - -# it 'should contain the rule' do -# pending("MODULES-2124 should be resolved for clusterip RHEL7 support") if default['platform'] =~ /el-7/ -# shell('iptables-save') do |r| -# expect(r.stdout).to match(/-A FORWARD -d (1.1.1.1\/32|1.1.1.1) -i eth0 -p tcp -m comment --comment "830 - clusterip test" -j CLUSTERIP --new --hashmode sourceip --clustermac 01:00:5E:00:00:00 --total-nodes 2 --local-node 1 --hash-init 1337/) # rubocop:disable Metrics/LineLength : Cannot reduce length to required size -# end -# end -# end -# end -# end -# end diff --git a/spec/acceptance/firewall_spec.rb b/spec/acceptance/firewall_spec.rb index df82941..4f77048 100644 --- a/spec/acceptance/firewall_spec.rb +++ b/spec/acceptance/firewall_spec.rb @@ -599,8 +599,7 @@ describe 'firewall basics', docker: true do end end - context 'when LOCAL --limit-iface-in', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when LOCAL --limit-iface-in', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp97 = <<-PUPPETCODE class { '::firewall': } firewall { '613 - test': @@ -620,8 +619,7 @@ describe 'firewall basics', docker: true do end end - context 'when LOCAL --limit-iface-in fail', if: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when LOCAL --limit-iface-in fail', if: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp98 = <<-PUPPETCODE class { '::firewall': } firewall { '614 - test': @@ -643,8 +641,7 @@ describe 'firewall basics', docker: true do end end - context 'when duplicated LOCAL', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when duplicated LOCAL', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp99 = <<-PUPPETCODE class { '::firewall': } firewall { '615 - test': @@ -666,8 +663,7 @@ describe 'firewall basics', docker: true do end end - context 'when multiple addrtype', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when multiple addrtype', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp100 = <<-PUPPETCODE class { '::firewall': } firewall { '616 - test': @@ -687,8 +683,7 @@ describe 'firewall basics', docker: true do end end - context 'when multiple addrtype fail', if: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when multiple addrtype fail', if: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp101 = <<-PUPPETCODE class { '::firewall': } firewall { '616 - test': @@ -1672,8 +1667,7 @@ describe 'firewall basics', docker: true do end end - context 'when LOCAL --limit-iface-in', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when LOCAL --limit-iface-in', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp102 = <<-PUPPETCODE class { '::firewall': } firewall { '617 - test': @@ -1693,8 +1687,7 @@ describe 'firewall basics', docker: true do end end - context 'when LOCAL --limit-iface-in fail', if: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when LOCAL --limit-iface-in fail', if: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp103 = <<-PUPPETCODE class { '::firewall': } firewall { '618 - test': @@ -1716,8 +1709,7 @@ describe 'firewall basics', docker: true do end end - context 'when duplicated LOCAL', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when duplicated LOCAL', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp104 = <<-PUPPETCODE class { '::firewall': } firewall { '619 - test': @@ -1740,8 +1732,7 @@ describe 'firewall basics', docker: true do end end - context 'when multiple addrtype', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when multiple addrtype', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp105 = <<-PUPPETCODE class { '::firewall': } firewall { '620 - test': @@ -1762,8 +1753,7 @@ describe 'firewall basics', docker: true do end end - context 'when multiple addrtype fail', if: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when multiple addrtype fail', if: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do pp106 = <<-PUPPETCODE class { '::firewall': } firewall { '616 - test': diff --git a/spec/acceptance/resource_cmd_spec.rb b/spec/acceptance/resource_cmd_spec.rb index c9462c0..7dca994 100644 --- a/spec/acceptance/resource_cmd_spec.rb +++ b/spec/acceptance/resource_cmd_spec.rb @@ -64,8 +64,7 @@ describe 'puppet resource firewall command' do end end - context 'when accepts rules with multiple comments', unless: (fact('operatingsystem') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') || - (fact('operatingsystem') == 'CentOS' && fact('operatingsystemmajrelease') <= '5') do + context 'when accepts rules with multiple comments', unless: (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') <= '5') do before(:all) do iptables_flush_all_tables shell('iptables -A INPUT -j ACCEPT -p tcp --dport 80 -m comment --comment "http" -m comment --comment "http"') -- 2.45.2