]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
change hashlimit_htable_size to a lower value and add policycoreutils iac894-fails-centos8-docker
authoradrianiurca <adrian.iurca@gmail.com>
Mon, 23 Nov 2020 22:32:10 +0000 (00:32 +0200)
committeradrianiurca <adrian.iurca@gmail.com>
Wed, 25 Nov 2020 14:27:10 +0000 (16:27 +0200)
.travis.yml
spec/acceptance/firewall_attributes_exceptions_spec.rb
spec/acceptance/firewall_attributes_ipv6_exceptions_spec.rb
spec/acceptance/resource_cmd_spec.rb
spec/spec_helper_acceptance_local.rb

index b3aa0753ce85e804a40b8aacc1213e251c9f3345..7c031db1c52a2464562109708999211d442b2ac1 100644 (file)
@@ -13,7 +13,7 @@ before_install:
   - gem --version
   - bundle -v
 script:
-  - 'SIMPLECOV=yes bundle exec rake $CHECK'
+  - "SIMPLECOV=yes bundle exec rake $CHECK"
 bundler_args: --without system_tests
 rvm:
   - 2.5.7
@@ -27,103 +27,94 @@ stages:
 jobs:
   fast_finish: true
   include:
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_ub_6]'"
-      - "bundle exec rake 'litmus:install_agent[puppet6]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_ub_6]'"
+        - "bundle exec rake 'litmus:install_agent[puppet6]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_ub_6_puppet6
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_ub_5]'"
-      - "bundle exec rake 'litmus:install_agent[puppet5]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_ub_5]'"
+        - "bundle exec rake 'litmus:install_agent[puppet5]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_ub_5_puppet5
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_deb]'"
-      - "bundle exec rake 'litmus:install_agent[puppet5]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_deb]'"
+        - "bundle exec rake 'litmus:install_agent[puppet5]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_deb_puppet5
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_el7]'"
-      - "bundle exec rake 'litmus:install_agent[puppet5]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_el7]'"
+        - "bundle exec rake 'litmus:install_agent[puppet5]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_el7_puppet5
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_el8]'"
-      - "bundle exec rake 'litmus:install_agent[puppet5]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_el8]'"
+        - "bundle exec rake 'litmus:install_agent[puppet5]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
+      dist: xenial
       env: PLATFORMS=travis_el8_puppet5
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_deb]'"
-      - "bundle exec rake 'litmus:install_agent[puppet6]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_deb]'"
+        - "bundle exec rake 'litmus:install_agent[puppet6]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_deb_puppet6
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_el7]'"
-      - "bundle exec rake 'litmus:install_agent[puppet6]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_el7]'"
+        - "bundle exec rake 'litmus:install_agent[puppet6]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
       env: PLATFORMS=travis_el7_puppet6
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      before_script:
-      - "bundle exec rake 'litmus:provision_list[travis_el8]'"
-      - "bundle exec rake 'litmus:install_agent[puppet6]'"
-      - "bundle exec rake litmus:install_module"
+    - before_script:
+        - "bundle exec rake 'litmus:provision_list[travis_el8]'"
+        - "bundle exec rake 'litmus:install_agent[puppet6]'"
+        - "bundle exec rake 'litmus:install_module'"
       bundler_args:
+      dist: xenial
       env: PLATFORMS=travis_el8_puppet6
       rvm: 2.5.7
       script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"]
       services: docker
       stage: acceptance
-    -
-      env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
+    - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
       stage: static
-    -
-      env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
+    - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
       rvm: 2.4.5
       stage: spec
-    -
-      env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
+    - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
       rvm: 2.5.7
       stage: spec
 branches:
index 426c500f958820db9f1cda5089a30bd2e8dc4850..867c35675606164ee2c462b9f02aa03a0fc9499b 100644 (file)
@@ -1316,7 +1316,7 @@ describe 'firewall basics', docker: true do
           hashlimit_name          => 'upto',
           hashlimit_upto          => '16/sec',
           hashlimit_burst         => '640',
-          hashlimit_htable_size   => '1310000',
+          hashlimit_htable_size   => '1000000',
           hashlimit_htable_max    => '320000',
           hashlimit_htable_expire => '36000000',
           action                  => accept,
@@ -1335,7 +1335,7 @@ describe 'firewall basics', docker: true do
       end
     end
     it 'hashlimit_upto is set' do
-      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto --hashlimit-htable-size 1310000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "806 - hashlimit_upto test" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
+      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "806 - hashlimit_upto test" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
     end
   end
 
index 263ce704a06e7b8b512d61995641d7ee0815209c..4dc141c437717f4426507c224b7d5d8af4e62885 100644 (file)
@@ -376,7 +376,7 @@ describe 'firewall ipv6 attribute testing, exceptions' do
           hashlimit_name          => 'upto-ip6',
           hashlimit_upto          => '16/sec',
           hashlimit_burst         => '640',
-          hashlimit_htable_size   => '1310000',
+          hashlimit_htable_size   => '1000000',
           hashlimit_htable_max    => '320000',
           hashlimit_htable_expire => '36000000',
           action                  => accept,
@@ -434,7 +434,7 @@ describe 'firewall ipv6 attribute testing, exceptions' do
       expect(result.stdout).to match(%r{-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "503 - clamp_mss_to_pmtu" -j TCPMSS --clamp-mss-to-pmtu})
     end
     it 'hashlimit_name set to "upto-ip6"' do
-      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto-ip6 --hashlimit-htable-size 1310000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "803 - hashlimit_upto test ip6" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
+      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto-ip6 --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "803 - hashlimit_upto test ip6" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
     end
     it 'match_mark is set' do
       expect(result.stdout).to match(%r{-A INPUT -m mark --mark 0x1 -m comment --comment "503 match_mark ip6tables - test" -j REJECT --reject-with icmp6-port-unreachable})
index ebd43a9b12e4167ec702164e15e66acb06bffb3e..03a9aaef02f43304aaa0815a36cbd691da5f427e 100644 (file)
@@ -9,6 +9,7 @@ describe 'puppet resource firewall command' do
     config = run_shell('puppet config print config').stdout
     run_shell("sed -i -e \'s/^templatedir.*$//\' #{config}")
     run_shell('echo export LC_ALL=C > ~/.bashrc')
+    run_shell('echo export PATH="/opt/puppetlabs/bin:$PATH" > ~/.bashrc')
     run_shell('source ~/.bashrc')
   end
 
index 532d532a158493a0ebb69e6a951eb4c37663b42a..204955c8508349af61c354a678653900ce2f475a 100644 (file)
@@ -7,48 +7,59 @@ end
 
 def iptables_flush_all_tables
   ['filter', 'nat', 'mangle', 'raw'].each do |t|
-    expect(run_shell("iptables -t #{t} -F").stderr).to eq('')
+    expect(LitmusHelper.instance.run_shell("iptables -t #{t} -F").stderr).to eq('')
   end
 end
 
 def ip6tables_flush_all_tables
   ['filter', 'mangle'].each do |t|
-    expect(run_shell("ip6tables -t #{t} -F").stderr).to eq('')
+    expect(LitmusHelper.instance.run_shell("ip6tables -t #{t} -F").stderr).to eq('')
   end
 end
 
 def install_iptables
-  run_shell('iptables -V')
+  LitmusHelper.instance.run_shell('iptables -V')
 rescue
   if os[:family] == 'redhat'
-    run_shell('yum install iptables-services -y')
+    LitmusHelper.instance.run_shell('yum install iptables-services -y')
   else
-    run_shell('apt-get install iptables -y')
+    LitmusHelper.instance.run_shell('apt-get install iptables -y')
   end
 end
 
 def iptables_version
   install_iptables
-  x = run_shell('iptables -V')
+  x = LitmusHelper.instance.run_shell('iptables -V')
   x.stdout.split(' ')[1][1..-1]
 end
 
 def pre_setup
-  run_shell('mkdir -p /lib/modules/`uname -r`')
-  run_shell('depmod -a')
+  LitmusHelper.instance.run_shell('mkdir -p /lib/modules/`uname -r`')
+  LitmusHelper.instance.run_shell('depmod -a')
 end
 
 def update_profile_file
-  run_shell("sed -i '/mesg n/c\\test -t 0 && mesg n || true' ~/.profile")
-  run_shell("sed -i '/mesg n || true/c\\test -t 0 && mesg n || true' ~/.profile")
+  LitmusHelper.instance.run_shell("sed -i '/mesg n/c\\test -t 0 && mesg n || true' ~/.profile")
+  LitmusHelper.instance.run_shell("sed -i '/mesg n || true/c\\test -t 0 && mesg n || true' ~/.profile")
 end
 
 def fetch_os_name
-  @facter_os_name ||= run_shell('facter os.name').stdout.delete("\n").downcase
+  @facter_os_name ||= LitmusHelper.instance.run_shell('facter os.name').stdout.delete("\n").downcase
 end
 
 RSpec.configure do |c|
   c.before :suite do
+    if fetch_os_name == 'centos' && os[:release].to_i == 8
+      pp = <<-PUPPETCODE
+        package { 'iptables-services':
+          ensure => 'latest',
+        }
+        package { 'policycoreutils':
+          ensure => 'latest',
+        }
+      PUPPETCODE
+      LitmusHelper.instance.apply_manifest(pp)
+    end
     if os[:family] == 'debian' && os[:release].to_i == 10
       pp = <<-PUPPETCODE
         package { 'net-tools':