Révision 01d8a819
Styling to make tests green
spec/classes/ip_nat_spec.rb | ||
---|---|---|
9 | 9 |
|
10 | 10 |
it { is_expected.to compile } |
11 | 11 |
|
12 |
it { is_expected.to contain_file('/etc/nftables/puppet/ip-nat.nft').with( |
|
13 |
:ensure => 'file', |
|
14 |
:owner => 'root', |
|
15 |
:group => 'root', |
|
16 |
:mode => '0640', |
|
17 |
)} |
|
12 |
it { |
|
13 |
is_expected.to contain_file('/etc/nftables/puppet/ip-nat.nft').with( |
|
14 |
ensure: 'file', |
|
15 |
owner: 'root', |
|
16 |
group: 'root', |
|
17 |
mode: '0640', |
|
18 |
) |
|
19 |
} |
|
18 | 20 |
|
19 | 21 |
context 'chain prerouting' do |
20 |
it { is_expected.to contain_concat('nftables-ip-nat-chain-PREROUTING').with( |
|
21 |
:path => '/etc/nftables/puppet/ip-nat-chain-PREROUTING.nft', |
|
22 |
:owner => 'root', |
|
23 |
:group => 'root', |
|
24 |
:mode => '0640', |
|
25 |
:ensure_newline => true, |
|
26 |
)} |
|
27 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-header').with( |
|
28 |
:target => 'nftables-ip-nat-chain-PREROUTING', |
|
29 |
:content => /^chain PREROUTING {$/, |
|
30 |
:order => '00', |
|
31 |
)} |
|
32 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-type').with( |
|
33 |
:target => 'nftables-ip-nat-chain-PREROUTING', |
|
34 |
:content => /^ type nat hook prerouting priority -100$/, |
|
35 |
:order => '01', |
|
36 |
)} |
|
37 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-policy').with( |
|
38 |
:target => 'nftables-ip-nat-chain-PREROUTING', |
|
39 |
:content => /^ policy accept$/, |
|
40 |
:order => '02', |
|
41 |
)} |
|
42 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-footer').with( |
|
43 |
:target => 'nftables-ip-nat-chain-PREROUTING', |
|
44 |
:content => /^}$/, |
|
45 |
:order => '99', |
|
46 |
)} |
|
22 |
it { |
|
23 |
is_expected.to contain_concat('nftables-ip-nat-chain-PREROUTING').with( |
|
24 |
path: '/etc/nftables/puppet/ip-nat-chain-PREROUTING.nft', |
|
25 |
owner: 'root', |
|
26 |
group: 'root', |
|
27 |
mode: '0640', |
|
28 |
ensure_newline: true, |
|
29 |
) |
|
30 |
} |
|
31 |
it { |
|
32 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-header').with( |
|
33 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
34 |
content: %r{^chain PREROUTING \{$}, |
|
35 |
order: '00', |
|
36 |
) |
|
37 |
} |
|
38 |
it { |
|
39 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-type').with( |
|
40 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
41 |
content: %r{^ type nat hook prerouting priority -100$}, |
|
42 |
order: '01', |
|
43 |
) |
|
44 |
} |
|
45 |
it { |
|
46 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-policy').with( |
|
47 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
48 |
content: %r{^ policy accept$}, |
|
49 |
order: '02', |
|
50 |
) |
|
51 |
} |
|
52 |
it { |
|
53 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-footer').with( |
|
54 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
55 |
content: %r{^\}$}, |
|
56 |
order: '99', |
|
57 |
) |
|
58 |
} |
|
47 | 59 |
end |
48 | 60 |
|
49 | 61 |
context 'chain output' do |
50 |
it { is_expected.to contain_concat('nftables-ip-nat-chain-POSTROUTING').with( |
|
51 |
:path => '/etc/nftables/puppet/ip-nat-chain-POSTROUTING.nft', |
|
52 |
:owner => 'root', |
|
53 |
:group => 'root', |
|
54 |
:mode => '0640', |
|
55 |
:ensure_newline => true, |
|
56 |
)} |
|
57 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with( |
|
58 |
:target => 'nftables-ip-nat-chain-POSTROUTING', |
|
59 |
:content => /^chain POSTROUTING {$/, |
|
60 |
:order => '00', |
|
61 |
)} |
|
62 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with( |
|
63 |
:target => 'nftables-ip-nat-chain-POSTROUTING', |
|
64 |
:content => /^ type nat hook postrouting priority 100$/, |
|
65 |
:order => '01', |
|
66 |
)} |
|
67 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with( |
|
68 |
:target => 'nftables-ip-nat-chain-POSTROUTING', |
|
69 |
:content => /^ policy accept$/, |
|
70 |
:order => '02', |
|
71 |
)} |
|
72 |
it { is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with( |
|
73 |
:target => 'nftables-ip-nat-chain-POSTROUTING', |
|
74 |
:content => /^}$/, |
|
75 |
:order => '99', |
|
76 |
)} |
|
62 |
it { |
|
63 |
is_expected.to contain_concat('nftables-ip-nat-chain-POSTROUTING').with( |
|
64 |
path: '/etc/nftables/puppet/ip-nat-chain-POSTROUTING.nft', |
|
65 |
owner: 'root', |
|
66 |
group: 'root', |
|
67 |
mode: '0640', |
|
68 |
ensure_newline: true, |
|
69 |
) |
|
70 |
} |
|
71 |
it { |
|
72 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with( |
|
73 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
74 |
content: %r{^chain POSTROUTING \{$}, |
|
75 |
order: '00', |
|
76 |
) |
|
77 |
} |
|
78 |
it { |
|
79 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with( |
|
80 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
81 |
content: %r{^ type nat hook postrouting priority 100$}, |
|
82 |
order: '01', |
|
83 |
) |
|
84 |
} |
|
85 |
it { |
|
86 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with( |
|
87 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
88 |
content: %r{^ policy accept$}, |
|
89 |
order: '02', |
|
90 |
) |
|
91 |
} |
|
92 |
it { |
|
93 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with( |
|
94 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
95 |
content: %r{^\}$}, |
|
96 |
order: '99', |
|
97 |
) |
|
98 |
} |
|
77 | 99 |
end |
78 | 100 |
end |
79 | 101 |
end |
Formats disponibles : Unified diff