Projet

Général

Profil

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

root / spec / classes / rules / out / chrony_spec.rb @ 51850192

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

1 7937a13b Tim Meusel
# frozen_string_literal: true
2
3
require 'spec_helper'
4
5
describe 'nftables::rules::out::chrony' 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.with_all_deps }
12
        it { is_expected.to contain_nftables__rule('default_out-chrony').with_content('udp dport 123 accept') }
13
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony') }
14
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_header') }
15
      end
16
17
      context 'with two IPv4 addresses as array' do
18
        let(:params) do
19
          { servers: ['1.2.3.4', '5.6.7.8'] }
20
        end
21
22
        it { is_expected.to compile.with_all_deps }
23
        it { is_expected.to contain_nftables__rule('default_out-chrony_v4').with_content('ip daddr {1.2.3.4,5.6.7.8} udp dport 123 accept') }
24
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v4') }
25
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v4_header') }
26
      end
27
28
      context 'with ipv6 & ipv4 address as array' do
29
        let(:params) do
30
          { servers: ['fe80::1', '1.2.3.4'] }
31
        end
32
33
        it { is_expected.to compile.with_all_deps }
34
        it { is_expected.to contain_nftables__rule('default_out-chrony_v4').with_content('ip daddr {1.2.3.4} udp dport 123 accept') }
35
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v4') }
36
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v4_header') }
37
        it { is_expected.to contain_nftables__rule('default_out-chrony_v6').with_content('ip6 daddr {fe80::1} udp dport 123 accept') }
38
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v6') }
39
        it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_out-rule-chrony_v6_header') }
40
      end
41
    end
42
  end
43
end