From 9e0cc05e68d7164ad47e91bd9afd968317b52e0e Mon Sep 17 00:00:00 2001 From: tphoney Date: Mon, 4 Mar 2019 15:41:11 +0000 Subject: [PATCH] (FM-7785) remove sles10 checks from tests --- .../firewall_attributes_exceptions_spec.rb | 8 ++--- spec/acceptance/firewall_bridging_spec.rb | 2 +- spec/acceptance/firewall_dscp_spec.rb | 2 +- spec/acceptance/firewall_iptmodules_spec.rb | 2 +- spec/acceptance/firewall_mss_spec.rb | 2 +- spec/acceptance/ip6_fragment_spec.rb | 2 +- spec/acceptance/match_mark_spec.rb | 2 +- spec/acceptance/purge_spec.rb | 2 +- spec/acceptance/resource_cmd_spec.rb | 30 +++++++++---------- 9 files changed, 25 insertions(+), 27 deletions(-) diff --git a/spec/acceptance/firewall_attributes_exceptions_spec.rb b/spec/acceptance/firewall_attributes_exceptions_spec.rb index 2eff413..4989dcb 100644 --- a/spec/acceptance/firewall_attributes_exceptions_spec.rb +++ b/spec/acceptance/firewall_attributes_exceptions_spec.rb @@ -375,7 +375,7 @@ describe 'firewall basics', docker: true do end # RHEL5 does not support --random - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} describe 'random' do context 'when 192.168.1.1' do pp40 = <<-PUPPETCODE @@ -405,7 +405,7 @@ describe 'firewall basics', docker: true do # iptables version 1.3.5 is not suppored by the ip6tables provider # iptables version 1.4.7 fails for multiple hl entries - if default['platform'] !~ %r{(el-5|el-6|sles-10|sles-11)} + if default['platform'] !~ %r{(el-5|el-6|sles-11)} describe 'hop_limit' do context 'when 5' do pp42 = <<-PUPPETCODE @@ -1195,7 +1195,7 @@ describe 'firewall basics', docker: true do end # iptables version 1.3.5 does not support masks on MARK rules - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} describe 'set_mark' do context 'when 0x3e8/0xffffffff' do pp73 = <<-PUPPETCODE @@ -1394,7 +1394,7 @@ describe 'firewall basics', docker: true do end it 'contains the rule' do shell('iptables-save') do |r| - if os[:family] == 'redhat' && os[:release].start_with?('5') || (default['platform'] =~ %r{sles-10}) + if os[:family] == 'redhat' && os[:release].start_with?('5') expect(r.stdout).to match(%r{-A INPUT -s 10.1.5.28 -p tcp -m mac --mac-source 0A:1B:3C:4D:5E:6F -m comment --comment "610 - test"}) else expect(r.stdout).to match(%r{-A INPUT -s 10.1.5.28\/(32|255\.255\.255\.255) -p tcp -m mac --mac-source 0A:1B:3C:4D:5E:6F -m comment --comment "610 - test"}) diff --git a/spec/acceptance/firewall_bridging_spec.rb b/spec/acceptance/firewall_bridging_spec.rb index 6f68dea..dda7e84 100644 --- a/spec/acceptance/firewall_bridging_spec.rb +++ b/spec/acceptance/firewall_bridging_spec.rb @@ -7,7 +7,7 @@ describe 'firewall bridging' do end describe 'iptables physdev tests' do # iptables version 1.3.5 is not suppored by the ip6tables provider - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} describe 'ip6tables physdev tests' do context 'when physdev_in eth0' do pp8 = <<-PUPPETCODE diff --git a/spec/acceptance/firewall_dscp_spec.rb b/spec/acceptance/firewall_dscp_spec.rb index 779411d..4552f76 100644 --- a/spec/acceptance/firewall_dscp_spec.rb +++ b/spec/acceptance/firewall_dscp_spec.rb @@ -56,7 +56,7 @@ describe 'firewall DSCP' do end end - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + unless os[:family] == 'redhat' && os[:release].start_with?('5') describe 'dscp ipv6 tests' do context 'when set_dscp 0x01' do pp3 = <<-PUPPETCODE diff --git a/spec/acceptance/firewall_iptmodules_spec.rb b/spec/acceptance/firewall_iptmodules_spec.rb index 0e189db..92464cb 100644 --- a/spec/acceptance/firewall_iptmodules_spec.rb +++ b/spec/acceptance/firewall_iptmodules_spec.rb @@ -131,7 +131,7 @@ describe 'firewall iptmodules' do end # Older OSes don't have addrtype so we leave those properties out. # el-5 doesn't support ipv6 by default - elsif default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + elsif default['platform'] !~ %r{el-5} describe 'ip6tables ipt_modules tests' do context 'when all the modules with multiple args' do pp5 = <<-PUPPETCODE diff --git a/spec/acceptance/firewall_mss_spec.rb b/spec/acceptance/firewall_mss_spec.rb index d389b17..a42a730 100644 --- a/spec/acceptance/firewall_mss_spec.rb +++ b/spec/acceptance/firewall_mss_spec.rb @@ -6,7 +6,7 @@ describe 'firewall MSS' do ip6tables_flush_all_tables end - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} describe 'mss ipv6 tests' do context 'when 1360' do pp3 = <<-PUPPETCODE diff --git a/spec/acceptance/ip6_fragment_spec.rb b/spec/acceptance/ip6_fragment_spec.rb index a83ac71..ffa7fba 100644 --- a/spec/acceptance/ip6_fragment_spec.rb +++ b/spec/acceptance/ip6_fragment_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -if default['platform'] =~ %r{el-5} || default['platform'] =~ %r{sles-10} +if default['platform'] =~ %r{el-5} describe "firewall ip6tables doesn't work on 1.3.5 because --comment is missing" do before :all do iptables_flush_all_tables diff --git a/spec/acceptance/match_mark_spec.rb b/spec/acceptance/match_mark_spec.rb index e62a339..c473382 100644 --- a/spec/acceptance/match_mark_spec.rb +++ b/spec/acceptance/match_mark_spec.rb @@ -6,7 +6,7 @@ describe 'firewall match marks' do ip6tables_flush_all_tables end - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} describe 'match_mark' do context 'when 0x1' do pp1 = <<-PUPPETCODE diff --git a/spec/acceptance/purge_spec.rb b/spec/acceptance/purge_spec.rb index 353631c..bd17b7d 100644 --- a/spec/acceptance/purge_spec.rb +++ b/spec/acceptance/purge_spec.rb @@ -125,7 +125,7 @@ describe 'purge tests' do end end - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + unless os[:family] == 'redhat' && os[:release].start_with?('5') context 'when ipv6 chain purge' do after(:all) do ip6tables_flush_all_tables diff --git a/spec/acceptance/resource_cmd_spec.rb b/spec/acceptance/resource_cmd_spec.rb index 2ee0469..6a22ecd 100644 --- a/spec/acceptance/resource_cmd_spec.rb +++ b/spec/acceptance/resource_cmd_spec.rb @@ -111,22 +111,20 @@ describe 'puppet resource firewall command' do end end - if default['platform'] !~ %r{sles-10} - context 'when accepts rules utilizing the statistic module' do - before :all do - iptables_flush_all_tables - # This command doesn't work with all versions/oses, so let it fail - shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 2 -j SNAT --to-source 2.3.4.5', acceptable_exit_codes: [0, 1, 2]) - shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 1 --packet 0 -j SNAT --to-source 2.3.4.6') - shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode random --probability 0.99 -j SNAT --to-source 2.3.4.7') - end + context 'when accepts rules utilizing the statistic module' do + before :all do + iptables_flush_all_tables + # This command doesn't work with all versions/oses, so let it fail + shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 2 -j SNAT --to-source 2.3.4.5', acceptable_exit_codes: [0, 1, 2]) + shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode nth --every 1 --packet 0 -j SNAT --to-source 2.3.4.6') + shell('iptables -t nat -A POSTROUTING -d 1.2.3.4/32 -o eth0 -m statistic --mode random --probability 0.99 -j SNAT --to-source 2.3.4.7') + end - it do - shell('puppet resource firewall') do |r| - r.exit_code.should be_zero - # don't check stdout, testing preexisting rules, output is normal - r.stderr.should be_empty - end + it do + shell('puppet resource firewall') do |r| + r.exit_code.should be_zero + # don't check stdout, testing preexisting rules, output is normal + r.stderr.should be_empty end end end @@ -183,7 +181,7 @@ describe 'puppet resource firewall command' do # version of iptables that ships with el5 doesn't work with the # ip6tables provider # TODO: Test below fails if this file is run seperately. i.e. bundle exec rspec spec/acceptance/resource_cmd_spec.rb - if default['platform'] !~ %r{el-5} && default['platform'] !~ %r{sles-10} + if default['platform'] !~ %r{el-5} context 'when dport/sport with ip6tables' do before :all do if os['family'] == 'debian' -- 2.45.2