Révision c82b960a
rubocop:auto_correct results
spec/classes/router_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'spec_helper' |
2 | 4 |
|
3 | 5 |
describe 'nftables' do |
... | ... | |
31 | 33 |
it { is_expected.to compile } |
32 | 34 |
|
33 | 35 |
it { |
34 |
is_expected.to contain_concat('nftables-inet-filter-chain-default_fwd').with(
|
|
35 |
path: '/etc/nftables/puppet-preflight/inet-filter-chain-default_fwd.nft',
|
|
36 |
owner: 'root',
|
|
37 |
group: 'root',
|
|
38 |
mode: '0640',
|
|
36 |
expect(subject).to contain_concat('nftables-inet-filter-chain-default_fwd').with(
|
|
37 |
path: '/etc/nftables/puppet-preflight/inet-filter-chain-default_fwd.nft', |
|
38 |
owner: 'root', |
|
39 |
group: 'root', |
|
40 |
mode: '0640', |
|
39 | 41 |
ensure_newline: true |
40 | 42 |
) |
41 | 43 |
} |
44 |
|
|
42 | 45 |
it { |
43 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-header').with(
|
|
44 |
target: 'nftables-inet-filter-chain-default_fwd',
|
|
46 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-header').with(
|
|
47 |
target: 'nftables-inet-filter-chain-default_fwd', |
|
45 | 48 |
content: %r{^chain default_fwd \{$}, |
46 |
order: '00'
|
|
49 |
order: '00' |
|
47 | 50 |
) |
48 | 51 |
} |
52 |
|
|
49 | 53 |
it { |
50 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-rule-out').with(
|
|
51 |
target: 'nftables-inet-filter-chain-default_fwd',
|
|
54 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-rule-out').with(
|
|
55 |
target: 'nftables-inet-filter-chain-default_fwd', |
|
52 | 56 |
content: %r{^ iifname eth1 oifname eth0 accept$}, |
53 |
order: '20-nftables-inet-filter-chain-default_fwd-rule-out-b'
|
|
57 |
order: '20-nftables-inet-filter-chain-default_fwd-rule-out-b' |
|
54 | 58 |
) |
55 | 59 |
} |
60 |
|
|
56 | 61 |
it { |
57 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-rule-drop').with(
|
|
58 |
target: 'nftables-inet-filter-chain-default_fwd',
|
|
62 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-rule-drop').with(
|
|
63 |
target: 'nftables-inet-filter-chain-default_fwd', |
|
59 | 64 |
content: %r{^ iifname eth0 drop$}, |
60 |
order: '90-nftables-inet-filter-chain-default_fwd-rule-drop-b'
|
|
65 |
order: '90-nftables-inet-filter-chain-default_fwd-rule-drop-b' |
|
61 | 66 |
) |
62 | 67 |
} |
68 |
|
|
63 | 69 |
it { |
64 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-footer').with(
|
|
65 |
target: 'nftables-inet-filter-chain-default_fwd',
|
|
70 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-default_fwd-footer').with(
|
|
71 |
target: 'nftables-inet-filter-chain-default_fwd', |
|
66 | 72 |
content: %r{^\}$}, |
67 |
order: '99'
|
|
73 |
order: '99' |
|
68 | 74 |
) |
69 | 75 |
} |
70 | 76 |
|
71 | 77 |
it { |
72 |
is_expected.to contain_concat('nftables-ip-nat-chain-PREROUTING').with(
|
|
73 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-PREROUTING.nft',
|
|
74 |
owner: 'root',
|
|
75 |
group: 'root',
|
|
76 |
mode: '0640',
|
|
78 |
expect(subject).to contain_concat('nftables-ip-nat-chain-PREROUTING').with(
|
|
79 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-PREROUTING.nft', |
|
80 |
owner: 'root', |
|
81 |
group: 'root', |
|
82 |
mode: '0640', |
|
77 | 83 |
ensure_newline: true |
78 | 84 |
) |
79 | 85 |
} |
86 |
|
|
80 | 87 |
it { |
81 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-header').with(
|
|
82 |
target: 'nftables-ip-nat-chain-PREROUTING',
|
|
88 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-header').with(
|
|
89 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
83 | 90 |
content: %r{^chain PREROUTING \{$}, |
84 |
order: '00'
|
|
91 |
order: '00' |
|
85 | 92 |
) |
86 | 93 |
} |
94 |
|
|
87 | 95 |
it { |
88 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-type').with(
|
|
89 |
target: 'nftables-ip-nat-chain-PREROUTING',
|
|
96 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-type').with(
|
|
97 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
90 | 98 |
content: %r{^ type nat hook prerouting priority -100$}, |
91 |
order: '01-nftables-ip-nat-chain-PREROUTING-rule-type-b'
|
|
99 |
order: '01-nftables-ip-nat-chain-PREROUTING-rule-type-b' |
|
92 | 100 |
) |
93 | 101 |
} |
102 |
|
|
94 | 103 |
it { |
95 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-policy').with(
|
|
96 |
target: 'nftables-ip-nat-chain-PREROUTING',
|
|
104 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-rule-policy').with(
|
|
105 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
97 | 106 |
content: %r{^ policy accept$}, |
98 |
order: '02-nftables-ip-nat-chain-PREROUTING-rule-policy-b'
|
|
107 |
order: '02-nftables-ip-nat-chain-PREROUTING-rule-policy-b' |
|
99 | 108 |
) |
100 | 109 |
} |
110 |
|
|
101 | 111 |
it { |
102 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-footer').with(
|
|
103 |
target: 'nftables-ip-nat-chain-PREROUTING',
|
|
112 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-PREROUTING-footer').with(
|
|
113 |
target: 'nftables-ip-nat-chain-PREROUTING', |
|
104 | 114 |
content: %r{^\}$}, |
105 |
order: '99'
|
|
115 |
order: '99' |
|
106 | 116 |
) |
107 | 117 |
} |
108 | 118 |
|
109 | 119 |
it { |
110 |
is_expected.to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
|
|
111 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft',
|
|
112 |
owner: 'root',
|
|
113 |
group: 'root',
|
|
114 |
mode: '0640',
|
|
120 |
expect(subject).to contain_concat('nftables-ip-nat-chain-POSTROUTING').with(
|
|
121 |
path: '/etc/nftables/puppet-preflight/ip-nat-chain-POSTROUTING.nft', |
|
122 |
owner: 'root', |
|
123 |
group: 'root', |
|
124 |
mode: '0640', |
|
115 | 125 |
ensure_newline: true |
116 | 126 |
) |
117 | 127 |
} |
128 |
|
|
118 | 129 |
it { |
119 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
|
|
120 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
130 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-header').with(
|
|
131 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
121 | 132 |
content: %r{^chain POSTROUTING \{$}, |
122 |
order: '00'
|
|
133 |
order: '00' |
|
123 | 134 |
) |
124 | 135 |
} |
136 |
|
|
125 | 137 |
it { |
126 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
|
|
127 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
138 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-type').with(
|
|
139 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
128 | 140 |
content: %r{^ type nat hook postrouting priority 100$}, |
129 |
order: '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b'
|
|
141 |
order: '01-nftables-ip-nat-chain-POSTROUTING-rule-type-b' |
|
130 | 142 |
) |
131 | 143 |
} |
144 |
|
|
132 | 145 |
it { |
133 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
|
|
134 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
146 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-policy').with(
|
|
147 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
135 | 148 |
content: %r{^ policy accept$}, |
136 |
order: '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b'
|
|
149 |
order: '02-nftables-ip-nat-chain-POSTROUTING-rule-policy-b' |
|
137 | 150 |
) |
138 | 151 |
} |
152 |
|
|
139 | 153 |
it { |
140 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade').with(
|
|
141 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
154 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-rule-masquerade').with(
|
|
155 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
142 | 156 |
content: %r{^ oifname eth0 masquerade$}, |
143 |
order: '20-nftables-ip-nat-chain-POSTROUTING-rule-masquerade-b'
|
|
157 |
order: '20-nftables-ip-nat-chain-POSTROUTING-rule-masquerade-b' |
|
144 | 158 |
) |
145 | 159 |
} |
160 |
|
|
146 | 161 |
it { |
147 |
is_expected.to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
|
|
148 |
target: 'nftables-ip-nat-chain-POSTROUTING',
|
|
162 |
expect(subject).to contain_concat__fragment('nftables-ip-nat-chain-POSTROUTING-footer').with(
|
|
163 |
target: 'nftables-ip-nat-chain-POSTROUTING', |
|
149 | 164 |
content: %r{^\}$}, |
150 |
order: '99'
|
|
165 |
order: '99' |
|
151 | 166 |
) |
152 | 167 |
} |
153 | 168 |
end |
Formats disponibles : Unified diff