]> gitweb.fluxo.info Git - puppet-ferm.git/commitdiff
add test for array support
authorKilian Engelhardt <kilian.engelhardt@godaddy.com>
Tue, 6 Aug 2019 09:22:47 +0000 (11:22 +0200)
committerKilian Engelhardt <kilian.engelhardt@godaddy.com>
Fri, 9 Aug 2019 15:43:26 +0000 (17:43 +0200)
spec/defines/rule_spec.rb

index bd4ed731d66770227557d870f5d777e7dc56730a..53a11a48e17df7b2adc30fbd061f5fd72286c5ac 100644 (file)
@@ -40,6 +40,24 @@ describe 'ferm::rule', type: :define do
         it { is_expected.to contain_concat__fragment('INPUT-eth0-aaa').with_content("interface eth0 {\n") }
         it { is_expected.to contain_concat__fragment('INPUT-eth0-zzz').with_content("}\n") }
       end
+      context 'with a specific interface using array for daddr' do
+        let(:title) { 'filter-ssh' }
+        let :params do
+          {
+            chain: 'INPUT',
+            policy: 'ACCEPT',
+            proto: 'tcp',
+            dport: '22',
+            daddr: ['127.0.0.1', '123.123.123.123', ['10.0.0.1', '10.0.0.2']],
+            interface: 'eth0'
+          }
+        end
+
+        it { is_expected.to compile.with_all_deps }
+        it { is_expected.to contain_concat__fragment('INPUT-eth0-filter-ssh').with_content("  mod comment comment 'filter-ssh' proto tcp dport 22 daddr @ipfilter(127.0.0.1 123.123.123.123 10.0.0.1 10.0.0.2) ACCEPT;\n") }
+        it { is_expected.to contain_concat__fragment('INPUT-eth0-aaa').with_content("interface eth0 {\n") }
+        it { is_expected.to contain_concat__fragment('INPUT-eth0-zzz').with_content("}\n") }
+      end
     end
   end
 end