]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
add acceptance test for hex_string
authoradrianiurca <adrian.iurca@gmail.com>
Thu, 16 Jul 2020 08:57:39 +0000 (11:57 +0300)
committeradrianiurca <adrian.iurca@gmail.com>
Thu, 16 Jul 2020 09:17:58 +0000 (12:17 +0300)
lib/puppet/type/firewall.rb
spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb

index 889177cce5f8016e1487122fc98d14535783436d..c1accc3c66c685d9c861859d0de9fca5d931acb9 100644 (file)
@@ -2073,6 +2073,9 @@ Puppet::Type.newtype(:firewall) do
       String matching feature. Matches the package against the hex pattern
       given as an argument.
     PUPPETCODE
+    munge do |value|
+      _value = value.delete(' ')
+    end
   end
 
   newproperty(:string_algo, required_features: :string_matching) do
index 43c496382edf63fdc628caeff4a13de4ac069f83..13d7b1e228ae5ebc202651a43c736cb3a15a53e1 100644 (file)
@@ -261,6 +261,15 @@ describe 'firewall attribute testing, happy path', unless: (os[:family] == 'redh
           proto   => all,
           provider => 'ip6tables',
         }
+        firewall { '812 - hex_string':
+          chain       => 'INPUT',
+          proto       => 'tcp',
+          string_hex  => '|f4 6d 04 25 b2 02 00 0a|',
+          string_algo => 'kmp',
+          string_to   => '65535',
+          action      => accept,
+          provider    => 'ip6tables',
+        }
       PUPPETCODE
       idempotent_apply(pp)
     end
@@ -365,5 +374,8 @@ describe 'firewall attribute testing, happy path', unless: (os[:family] == 'redh
         expect(result.stdout).to match(regex)
       end
     end
+    it 'checks hex_string value' do
+      expect(result.stdout).to match(%r{-A INPUT -p tcp -m string --hex-string "|f46d0425b202000a|" --algo kmp --to 65535 -m comment --comment "812 - hex_string" -j ACCEPT})
+    end
   end
 end