Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / spec / classes / rules / dns_spec.rb @ e0bb7852

Historique | Voir | Annoter | Télécharger (1,36 ko)

1 c82b960a Steve Traylen
# frozen_string_literal: true
2
3 94a80621 Steve Traylen
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 67cdcf15 Steve Traylen
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 94a80621 Steve Traylen
    end
40
  end
41
end