root / spec / classes / rules / dns_spec.rb @ eac19d14
Historique | Voir | Annoter | Télécharger (1,36 ko)
1 |
# frozen_string_literal: true
|
---|---|
2 |
|
3 |
require 'spec_helper'
|
4 |
|
5 |
describe 'nftables::rules::dns' do |
6 |
on_supported_os.each do |os, os_facts|
|
7 |
context "on #{os}" do |
8 |
let(:facts) { os_facts }
|
9 |
|
10 |
context 'default options' do |
11 |
it { is_expected.to compile } |
12 |
it { is_expected.to contain_nftables__rule('default_in-dns_tcp').with_content('tcp dport {53} accept') } |
13 |
it { is_expected.to contain_nftables__rule('default_in-dns_udp').with_content('udp dport {53} accept') } |
14 |
end
|
15 |
|
16 |
context 'with ports set' do |
17 |
let(:params) do |
18 |
{ |
19 |
ports: [55, 60], |
20 |
} |
21 |
end
|
22 |
|
23 |
it { is_expected.to compile } |
24 |
it { is_expected.to contain_nftables__rule('default_in-dns_tcp').with_content('tcp dport {55, 60} accept') } |
25 |
it { is_expected.to contain_nftables__rule('default_in-dns_udp').with_content('udp dport {55, 60} accept') } |
26 |
end
|
27 |
|
28 |
context 'with input interfaces set' do |
29 |
let(:params) do |
30 |
{ |
31 |
iifname: %w[docker0 eth0], |
32 |
} |
33 |
end
|
34 |
|
35 |
it { is_expected.to compile } |
36 |
it { is_expected.to contain_nftables__rule('default_in-dns_tcp').with_content('iifname {docker0, eth0} tcp dport {53} accept') } |
37 |
it { is_expected.to contain_nftables__rule('default_in-dns_udp').with_content('iifname {docker0, eth0} udp dport {53} accept') } |
38 |
end
|
39 |
end
|
40 |
end
|
41 |
end
|