Révision c82b960a
rubocop:auto_correct results
spec/classes/snat4_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'spec_helper' |
2 | 4 |
|
3 | 5 |
describe 'nftables' do |
... | ... | |
36 | 38 |
it { is_expected.to compile } |
37 | 39 |
|
38 | 40 |
it { |
39 |
is_expected.to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
|
|
40 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft',
|
|
41 |
owner: 'root',
|
|
42 |
group: 'root',
|
|
43 |
mode: '0640',
|
|
41 |
expect(subject).to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
|
|
42 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft', |
|
43 |
owner: 'root', |
|
44 |
group: 'root', |
|
45 |
mode: '0640', |
|
44 | 46 |
ensure_newline: true |
45 | 47 |
) |
46 | 48 |
} |
49 |
|
|
47 | 50 |
it { |
48 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
|
|
49 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
51 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
|
|
52 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
50 | 53 |
content: %r{^chain POSTROUTING \{$}, |
51 |
order: '00'
|
|
54 |
order: '00' |
|
52 | 55 |
) |
53 | 56 |
} |
57 |
|
|
54 | 58 |
it { |
55 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
|
|
56 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
59 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
|
|
60 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
57 | 61 |
content: %r{^ type nat hook postrouting priority 100$}, |
58 |
order: '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b'
|
|
62 |
order: '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b' |
|
59 | 63 |
) |
60 | 64 |
} |
65 |
|
|
61 | 66 |
it { |
62 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
|
|
63 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
67 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
|
|
68 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
64 | 69 |
content: %r{^ policy accept$}, |
65 |
order: '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b'
|
|
70 |
order: '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b' |
|
66 | 71 |
) |
67 | 72 |
} |
73 |
|
|
68 | 74 |
it { |
69 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-static').with(
|
|
70 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
75 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-static').with(
|
|
76 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
71 | 77 |
content: %r{^ oifname eth0 snat 198\.51\.100\.1$}, |
72 |
order: '60-nftables-ip-nat-chain-POSTROUTING-rule-static-b'
|
|
78 |
order: '60-nftables-ip-nat-chain-POSTROUTING-rule-static-b' |
|
73 | 79 |
) |
74 | 80 |
} |
81 |
|
|
75 | 82 |
it { |
76 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1').with(
|
|
77 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
83 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1').with(
|
|
84 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
78 | 85 |
content: %r{^ oifname eth0 ip saddr 192\.0\.2\.2 snat 198\.51\.100\.3$}, |
79 |
order: '61-nftables-ip-nat-chain-POSTROUTING-rule-1_1-b'
|
|
86 |
order: '61-nftables-ip-nat-chain-POSTROUTING-rule-1_1-b' |
|
80 | 87 |
) |
81 | 88 |
} |
89 |
|
|
82 | 90 |
it { |
83 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1_smtp').with(
|
|
84 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
91 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1_smtp').with(
|
|
92 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
85 | 93 |
content: %r{^ ip saddr 192\.0\.2\.2 tcp dport 25 snat 198\.51\.100\.2$}, |
86 |
order: '70-nftables-ip-nat-chain-POSTROUTING-rule-1_1_smtp-b'
|
|
94 |
order: '70-nftables-ip-nat-chain-POSTROUTING-rule-1_1_smtp-b' |
|
87 | 95 |
) |
88 | 96 |
} |
97 |
|
|
89 | 98 |
it { |
90 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1_wireguard').with(
|
|
91 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
99 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-1_1_wireguard').with(
|
|
100 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
92 | 101 |
content: %r{^ ip saddr 192\.0\.2\.2 udp dport 51820 snat 198\.51\.100\.2$}, |
93 |
order: '70-nftables-ip-nat-chain-POSTROUTING-rule-1_1_wireguard-b'
|
|
102 |
order: '70-nftables-ip-nat-chain-POSTROUTING-rule-1_1_wireguard-b' |
|
94 | 103 |
) |
95 | 104 |
} |
105 |
|
|
96 | 106 |
it { |
97 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
|
|
98 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
107 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
|
|
108 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
99 | 109 |
content: %r{^\}$}, |
100 |
order: '99'
|
|
110 |
order: '99' |
|
101 | 111 |
) |
102 | 112 |
} |
103 | 113 |
end |
Formats disponibles : Unified diff