Projet

Général

Profil

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

root / spec / classes / nftables_spec.rb @ e17693e3

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

1 64134e4e tr
require 'spec_helper'
2
3
describe 'nftables' do
4
  let(:pre_condition) { 'Exec{path => "/bin"}' }
5
6
  on_supported_os.each do |os, os_facts|
7
    context "on #{os}" do
8
      let(:facts) { os_facts }
9
10
      it { is_expected.to compile }
11 5acb554a tr
12
      it { is_expected.to contain_package('nftables') }
13
14 01d8a819 tr
      it {
15
        is_expected.to contain_file('/etc/nftables/puppet.nft').with(
16
          ensure: 'file',
17
          owner:  'root',
18
          group:  'root',
19
          mode:   '0640',
20
          source: 'puppet:///modules/nftables/config/puppet.nft',
21
        )
22
      }
23
24
      it {
25
        is_expected.to contain_file('/etc/nftables/puppet').with(
26
          ensure:  'directory',
27
          owner:   'root',
28
          group:   'root',
29
          mode:    '0750',
30
          purge:   true,
31
          force:   true,
32
          recurse: true,
33
        )
34
      }
35
36
      it {
37
        is_expected.to contain_service('nftables').with(
38
          ensure: 'running',
39
          enable: true,
40
        )
41
      }
42
43
      it {
44
        is_expected.to contain_service('firewalld').with(
45
          ensure: 'stopped',
46
          enable: 'mask',
47
        )
48
      }
49 e17693e3 Steve Traylen
      it { is_expected.to contain_class('nftables::rules::out::http') }
50
      it { is_expected.to contain_class('nftables::rules::out::https') }
51
      it { is_expected.to contain_class('nftables::rules::out::dns') }
52
      it { is_expected.to contain_class('nftables::rules::out::chrony') }
53
      it { is_expected.not_to contain_class('nftables::rules::out::all') }
54
      it { is_expected.not_to contain_nftables__rule('default_out-all') }
55
56
      context 'with out_all set true' do
57
        let(:params) do {
58
          out_all: true
59
        }
60
        end
61
62
        it { is_expected.to contain_class('nftables::rules::out::all') }
63
        it { is_expected.not_to contain_class('nftables::rules::out::http') }
64
        it { is_expected.not_to contain_class('nftables::rules::out::https') }
65
        it { is_expected.not_to contain_class('nftables::rules::out::dns') }
66
        it { is_expected.not_to contain_class('nftables::rules::out::chrony') }
67
        it { is_expected.to contain_nftables__rule('default_out-all').with_content('accept') }
68
        it { is_expected.to contain_nftables__rule('default_out-all').with_order('90') }
69
      end
70 64134e4e tr
    end
71
  end
72
end