root / spec / classes / nftables_spec.rb @ b171ac7f
Historique | Voir | Annoter | Télécharger (2,24 ko)
1 |
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 |
|
12 |
it { is_expected.to contain_package('nftables') }
|
13 |
|
14 |
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 |
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 |
{ |
59 |
out_all: true, |
60 |
} |
61 |
end
|
62 |
|
63 |
it { is_expected.to contain_class('nftables::rules::out::all') }
|
64 |
it { is_expected.not_to contain_class('nftables::rules::out::http') }
|
65 |
it { is_expected.not_to contain_class('nftables::rules::out::https') }
|
66 |
it { is_expected.not_to contain_class('nftables::rules::out::dns') }
|
67 |
it { is_expected.not_to contain_class('nftables::rules::out::chrony') }
|
68 |
it { is_expected.to contain_nftables__rule('default_out-all').with_content('accept') } |
69 |
it { is_expected.to contain_nftables__rule('default_out-all').with_order('90') } |
70 |
end
|
71 |
end
|
72 |
end
|
73 |
end
|