From 6b6c2ab36ebaeac76dfbb95cce514084b760b1c9 Mon Sep 17 00:00:00 2001 From: adrianiurca Date: Thu, 16 Jul 2020 11:57:39 +0300 Subject: [PATCH] add acceptance test for hex_string --- lib/puppet/type/firewall.rb | 3 +++ .../firewall_attributes_ipv6_happy_path_spec.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index 889177c..c1accc3 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -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 diff --git a/spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb b/spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb index 43c4963..13d7b1e 100644 --- a/spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb +++ b/spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb @@ -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 -- 2.45.2