]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
(maint) remove UNSUPPORTED_PLATFORMS filter and improve spec description
authorDavid Schmitt <david.schmitt@puppetlabs.com>
Mon, 18 Apr 2016 18:10:21 +0000 (19:10 +0100)
committerDavid Schmitt <david.schmitt@puppet.com>
Mon, 18 Apr 2016 18:31:16 +0000 (19:31 +0100)
25 files changed:
spec/acceptance/change_source_spec.rb
spec/acceptance/class_spec.rb
spec/acceptance/connlimit_spec.rb
spec/acceptance/connmark_spec.rb
spec/acceptance/firewall_bridging_spec.rb
spec/acceptance/firewall_dscp_spec.rb
spec/acceptance/firewall_iptmodules_spec.rb
spec/acceptance/firewall_mss_spec.rb
spec/acceptance/firewall_spec.rb
spec/acceptance/firewall_tee_spec.rb
spec/acceptance/firewall_time_spec.rb
spec/acceptance/firewall_uid_spec.rb
spec/acceptance/firewallchain_spec.rb
spec/acceptance/invert_spec.rb
spec/acceptance/ip6_fragment_spec.rb
spec/acceptance/isfragment_spec.rb
spec/acceptance/match_mark_spec.rb
spec/acceptance/params_spec.rb
spec/acceptance/purge_spec.rb
spec/acceptance/resource_cmd_spec.rb
spec/acceptance/rules_spec.rb
spec/acceptance/socket_spec.rb
spec/acceptance/standard_usage_spec.rb
spec/acceptance/unsupported_spec.rb [deleted file]
spec/spec_helper_acceptance.rb

index f59110870c31cce9ddd1d1ed3981c44ad60ee008..3a5dbeb4e1919b8da6e789ff736c4f0b0abe4bf1 100644 (file)
@@ -1,10 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-  describe 'reset' do
-    it 'deletes all rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
+describe 'changing the source' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'when unmanaged rules exist' do
index 0c74f97792192178d9e8ae163eee220535444e22..1a516abf5b05c173733d8420b02f2ee83404affe 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper_acceptance'
 
-describe "firewall class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe "firewall class" do
   it 'should run successfully' do
     pp = "class { 'firewall': }"
 
index 1dfbf1c8886b9a433755c86c3de50bbf819dd7cc..9ec461582f99a70ce2ef73380ad8c6e0871daae3 100644 (file)
@@ -1,14 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-
-  describe 'reset' do
-    it 'deletes all iptables rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
-    it 'deletes all ip6tables rules' do
-      shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush')
-    end
+describe 'connlimit property' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   if default['platform'] !~ /sles-10/
index b3409ab2d81800ea10491a379174a121425cf1be..ab3b76495ab9e770953605fe4e8aa16ac3c0a2b7 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'connmark property' do
 
   describe 'connmark' do
     context '50' do
@@ -9,7 +9,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
           class { '::firewall': }
           firewall { '502 - test':
             proto    => 'all',
-           connmark => '0x1',
+            connmark => '0x1',
             action   => reject,
           }
         EOS
index 487f1512e1a5ffa31c11bd1717210cb9369e347a..568d64cabfdba6acd33b0f001a990f1b73542618 100644 (file)
@@ -1,14 +1,9 @@
  require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-
-  describe 'reset' do
-    it 'deletes all iptables rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
-    it 'deletes all ip6tables rules' do
-      shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush')
-    end
+describe 'firewall bridging' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'iptables physdev tests' do
@@ -371,5 +366,4 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
         end
       end
     end
-
 end
index a85100a058b1bef4efa87a569ab090af6153d3f2..581f117a30b66a0b0587adc8a63314abc55e1fbd 100644 (file)
@@ -1,10 +1,9 @@
 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')
+describe 'firewall DSCP' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'dscp ipv4 tests' do
index 259a472f9635bc1104e57a843f68bcc2154e0f4c..24234c09420f29bec00834a981e06b72855f6499 100644 (file)
@@ -1,14 +1,9 @@
  require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-
-  describe 'reset' do
-    it 'deletes all iptables rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
-    it 'deletes all ip6tables rules' do
-      shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush')
-    end
+describe 'firewall iptmodules' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'iptables ipt_modules tests' do
index 4a2125b29514b6ac657be60707bf59aa1b3055ed..06390fb2e8f54602171cd4f6d348619f1a61cab8 100644 (file)
@@ -1,10 +1,9 @@
 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')
+describe 'firewall MSS' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'mss ipv4 tests' do
index def7d178c698220db06cf6e3285780938cb5ef6b..9f39c7ecef822ccba77e037f9e663ee111a58e6f 100644 (file)
@@ -1,11 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-
-  describe 'reset' do
-    it 'deletes all rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
+describe 'firewall basics' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe 'name' do
index c64c80c69dc5faeab10f12f71dc829ee264acb05..da07a28138f54b16309e7b63c5377fa00614ab66 100644 (file)
@@ -1,10 +1,9 @@
 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')
+describe 'firewall tee' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   if default['platform'] =~ /ubuntu-1404/ or default['platform'] =~ /ubuntu-1204/ or default['platform'] =~ /debian-7/ or default['platform'] =~ /debian-8/ or default['platform'] =~ /el-7/
@@ -13,7 +12,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
         it 'applies' do
           pp = <<-EOS
             class { '::firewall': }
-            firewall { 
+            firewall {
               '810 - tee_gateway':
                 chain   => 'PREROUTING',
                 table   => 'mangle',
@@ -39,7 +38,7 @@ describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfami
         it 'applies' do
           pp = <<-EOS
             class { '::firewall': }
-            firewall { 
+            firewall {
               '811 - tee_gateway6':
                 chain    => 'PREROUTING',
                 table    => 'mangle',
index e6ea34e3b190e4c98506921b48409ae5f81c8557..256977093cbe67b62bcaf8a5ef13bcddcdd47d7b 100644 (file)
@@ -1,11 +1,9 @@
 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')
+describe 'firewall time' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   if default['platform'] =~ /ubuntu-1404/ or default['platform'] =~ /debian-7/ or default['platform'] =~ /debian-8/ or default['platform'] =~ /el-7/
index ce45333e9488969c3b9fe060c5a257fe4f582e21..e4df7f89b53ed0c432b1923eff2df40f19611814 100644 (file)
@@ -1,14 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-
-  describe 'reset' do
-    it 'deletes all rules' do
-      shell('iptables --flush; iptables -t nat --flush; iptables -t mangle --flush')
-    end
-    it 'deletes all ip6tables rules' do
-      shell('ip6tables --flush; ip6tables -t nat --flush; ip6tables -t mangle --flush')
-    end
+describe 'firewall uid' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   describe "uid tests" do
index eaf71ccd33ff871455b0bdffab1f38e6316d6b31..ffc4e220b4ce000ea1935fa16d7816793bdb25e9 100644 (file)
@@ -1,9 +1,11 @@
 require 'spec_helper_acceptance'
 
-describe 'puppet resource firewallchain command:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'puppet resource firewallchain command' do
   before :all do
     iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
+
   describe 'ensure' do
     context 'present' do
       it 'applies cleanly' do
index 07d698a66f4f18bf1b6d01333e3179a24c0d58a5..5eba941966750ba873d2d181d0523da91f2bbe84 100644 (file)
@@ -1,8 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall type', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-  before(:all) do
+describe 'firewall inverting' do
+  before :all do
     iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   context "inverting rules" do
index 64728ed40df33a804715fcb5930a9cceb64138af..ed2256f280883ef0a2c1e4720a1ad722e12114a3 100644 (file)
@@ -1,8 +1,9 @@
 require 'spec_helper_acceptance'
 
 if default['platform'] =~ /el-5/ or default['platform'] =~ /sles-10/
-  describe "firewall ip6tables doesn't work on 1.3.5 because --comment is missing", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+  describe "firewall ip6tables doesn't work on 1.3.5 because --comment is missing" do
     before :all do
+      iptables_flush_all_tables
       ip6tables_flush_all_tables
     end
 
@@ -19,8 +20,9 @@ if default['platform'] =~ /el-5/ or default['platform'] =~ /sles-10/
     end
   end
 else
-  describe 'firewall ishasmorefrags/islastfrag/isfirstfrag properties', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+  describe 'firewall ishasmorefrags/islastfrag/isfirstfrag properties' do
     before :all do
+      iptables_flush_all_tables
       ip6tables_flush_all_tables
     end
 
index f48f27234c80d05a2544f2e619a7589425d839fd..8e879b2eb2da0ee27013fc6ac393274e97f26a74 100644 (file)
@@ -1,8 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'firewall isfragment property', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'firewall isfragment property' do
   before :all do
     iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   shared_examples "is idempotent" do |value, line_match|
index cf5858db0b35faaace497b909deb2c9dcb3892d2..17b80b4f6da5eb020512b8fe04392181aac5ddfe 100644 (file)
@@ -1,10 +1,9 @@
 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')
+describe 'firewall match marks' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   if default['platform'] !~ /el-5/ and default['platform'] !~ /sles-10/
index ca6652e0b65e1210c0d4f138fd26f510902f1c01..cac685a3134bcb1bae4321e17213f245ee37401a 100644 (file)
@@ -1,17 +1,16 @@
 require 'spec_helper_acceptance'
 
-describe "param based tests:", :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')
+describe 'param based tests' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   it 'test various params', :unless => (default['platform'].match(/el-5/) || fact('operatingsystem') == 'SLES') do
     iptables_flush_all_tables
 
     ppm = <<-EOS
-    firewall { '100 test': 
+    firewall { '100 test':
       table     => 'raw',
       socket    => 'true',
       chain     => 'PREROUTING',
index e191c12b4ecba47b3f1eea6d26f83abeebb0266c..4e052bab9724e28e6ed8893ea9b83b6ba9a02eae 100644 (file)
@@ -1,6 +1,11 @@
 require 'spec_helper_acceptance'
 
-describe "purge tests:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'purge tests' do
+  before :all do
+    iptables_flush_all_tables
+    ip6tables_flush_all_tables
+  end
+
   context('resources purge') do
     before(:all) do
       iptables_flush_all_tables
index 19fd3af1f87455f7af887661b0298799659c94b9..39845fb6eb677fa6cdce7342e216cd0281bb4f08 100644 (file)
@@ -3,7 +3,7 @@ require 'spec_helper_acceptance'
 # Here we want to test the the resource commands ability to work with different
 # existing ruleset scenarios. This will give the parsing capabilities of the
 # code a good work out.
-describe 'puppet resource firewall command:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'puppet resource firewall command' do
   before(:all) do
     # In order to properly check stderr for anomalies we need to fix the deprecation warnings from puppet.conf.
     config = shell('puppet config print config').stdout
index fee12dd7d1cc61f4f1d09cccaab024e5efdf03d9..3b27bd5ac76b23454d96cb5b9c2a987fac7cd041 100644 (file)
@@ -1,8 +1,9 @@
 require 'spec_helper_acceptance'
 
-describe 'complex ruleset 1', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'complex ruleset 1' do
   before :all do
     iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   after :all do
@@ -127,7 +128,7 @@ describe 'complex ruleset 2' do
   it 'applies cleanly' do
     pp = <<-EOS
       class { '::firewall': }
-      
+
       Firewall {
         proto => 'all',
         stage => 'pre',
index 5503a9a077872e299b7c3e6300e63aa6d3873ffd..84a53614ec01e899e3246c4d90a45cebce014c15 100644 (file)
@@ -1,9 +1,10 @@
 require 'spec_helper_acceptance'
 
 # RHEL5 does not support -m socket
-describe 'firewall socket property', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) || default['platform'] =~ /el-5/ || fact('operatingsystem') == 'SLES') do
+describe 'firewall socket property', :unless => default['platform'] =~ /el-5/ || fact('operatingsystem') == 'SLES' do
   before :all do
     iptables_flush_all_tables
+    ip6tables_flush_all_tables
   end
 
   shared_examples "is idempotent" do |value, line_match|
index afc0c42adee03067636d6e96ead2b892ec26d451..6c54f8c7cce239b0b0a7de5f6c96ce64ad22344b 100644 (file)
@@ -1,7 +1,7 @@
 require 'spec_helper_acceptance'
 
 # Some tests for the standard recommended usage
-describe 'standard usage tests:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
+describe 'standard usage tests' do
   it 'applies twice' do
     pp = <<-EOS
       class my_fw::pre {
diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb
deleted file mode 100644 (file)
index dfb75e2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'spec_helper_acceptance'
-
-describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
-  it 'should fail' do
-    pp = <<-EOS
-      class { 'firewall': }
-    EOS
-    expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not currently supported/i)
-  end
-end
index 44b5f8da579a8b460b0e41451ea373932535a190..a200bc823c77130fcdf32d17370c185fbe0388a4 100644 (file)
@@ -8,7 +8,7 @@ def iptables_flush_all_tables
 end
 
 def ip6tables_flush_all_tables
-  ['filter'].each do |t|
+  ['filter', 'nat', 'mangle'].each do |t|
     expect(shell("ip6tables -t #{t} -F").stderr).to eq("")
   end
 end
@@ -23,21 +23,16 @@ end
 
 run_puppet_install_helper
 
-UNSUPPORTED_PLATFORMS = ['windows','Solaris','Darwin']
-
 RSpec.configure do |c|
   # Project root
   proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
 
-  # Readable test descriptions
-  c.formatter = :documentation
-
   # Configure all nodes in nodeset
   c.before :suite do
     # Install module and dependencies
     hosts.each do |host|
       copy_module_to(host, :source => proj_root, :module_name => 'firewall')
-      on host, puppet('module install puppetlabs-stdlib --version 3.2.0'), { :acceptable_exit_codes => [0,1] }
+      on host, puppet('module install puppetlabs-stdlib --version 3.2.0')
     end
   end
 end