Révision c82b960a
rubocop:auto_correct results
spec/defines/chain_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'spec_helper' |
2 | 4 |
|
3 | 5 |
describe 'nftables::chain' do |
... | ... | |
17 | 19 |
it { is_expected.to contain_file('/etc/nftables/puppet/inet-filter-chain-MYCHAIN.nft').that_comes_before('Service[nftables]') } |
18 | 20 |
|
19 | 21 |
it { |
20 |
is_expected.to contain_concat('nftables-inet-filter-chain-MYCHAIN').with(
|
|
22 |
expect(subject).to contain_concat('nftables-inet-filter-chain-MYCHAIN').with(
|
|
21 | 23 |
path: '/etc/nftables/puppet-preflight/inet-filter-chain-MYCHAIN.nft', |
22 | 24 |
owner: 'root', |
23 | 25 |
group: 'root', |
... | ... | |
25 | 27 |
ensure_newline: true |
26 | 28 |
) |
27 | 29 |
} |
30 |
|
|
28 | 31 |
it { |
29 |
is_expected.to contain_file('/etc/nftables/puppet/inet-filter-chain-MYCHAIN.nft').with(
|
|
32 |
expect(subject).to contain_file('/etc/nftables/puppet/inet-filter-chain-MYCHAIN.nft').with(
|
|
30 | 33 |
ensure: 'file', |
31 | 34 |
source: '/etc/nftables/puppet-preflight/inet-filter-chain-MYCHAIN.nft', |
32 | 35 |
mode: '0640', |
... | ... | |
34 | 37 |
group: 'root' |
35 | 38 |
) |
36 | 39 |
} |
40 |
|
|
37 | 41 |
it { |
38 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-MYCHAIN-header').with(
|
|
42 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-MYCHAIN-header').with(
|
|
39 | 43 |
order: '00', |
40 | 44 |
content: "# Start of fragment order:00 MYCHAIN header\nchain MYCHAIN {", |
41 | 45 |
target: 'nftables-inet-filter-chain-MYCHAIN' |
42 | 46 |
) |
43 | 47 |
} |
48 |
|
|
44 | 49 |
it { |
45 |
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-MYCHAIN-footer').with(
|
|
50 |
expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-MYCHAIN-footer').with(
|
|
46 | 51 |
order: '99', |
47 | 52 |
content: "# Start of fragment order:99 MYCHAIN footer\n}", |
48 | 53 |
target: 'nftables-inet-filter-chain-MYCHAIN' |
... | ... | |
57 | 62 |
end |
58 | 63 |
|
59 | 64 |
it { |
60 |
is_expected.to contain_concat('nftables-ip6-foo-chain-MYCHAIN').with(
|
|
65 |
expect(subject).to contain_concat('nftables-ip6-foo-chain-MYCHAIN').with(
|
|
61 | 66 |
path: '/etc/nftables/puppet-preflight/ip6-foo-chain-MYCHAIN.nft', |
62 | 67 |
owner: 'root', |
63 | 68 |
group: 'root', |
... | ... | |
65 | 70 |
ensure_newline: true |
66 | 71 |
) |
67 | 72 |
} |
73 |
|
|
68 | 74 |
it { |
69 |
is_expected.to contain_file('/etc/nftables/puppet/ip6-foo-chain-MYCHAIN.nft').with(
|
|
75 |
expect(subject).to contain_file('/etc/nftables/puppet/ip6-foo-chain-MYCHAIN.nft').with(
|
|
70 | 76 |
ensure: 'file', |
71 | 77 |
source: '/etc/nftables/puppet-preflight/ip6-foo-chain-MYCHAIN.nft', |
72 | 78 |
mode: '0640', |
... | ... | |
74 | 80 |
group: 'root' |
75 | 81 |
) |
76 | 82 |
} |
83 |
|
|
77 | 84 |
it { |
78 |
is_expected.to contain_concat__fragment('nftables-ip6-foo-chain-MYCHAIN-header').with(
|
|
85 |
expect(subject).to contain_concat__fragment('nftables-ip6-foo-chain-MYCHAIN-header').with(
|
|
79 | 86 |
order: '00', |
80 | 87 |
content: "# Start of fragment order:00 MYCHAIN header\nchain MYCHAIN {", |
81 | 88 |
target: 'nftables-ip6-foo-chain-MYCHAIN' |
82 | 89 |
) |
83 | 90 |
} |
91 |
|
|
84 | 92 |
it { |
85 |
is_expected.to contain_concat__fragment('nftables-ip6-foo-chain-MYCHAIN-footer').with(
|
|
93 |
expect(subject).to contain_concat__fragment('nftables-ip6-foo-chain-MYCHAIN-footer').with(
|
|
86 | 94 |
order: '99', |
87 | 95 |
content: "# Start of fragment order:99 MYCHAIN footer\n}", |
88 | 96 |
target: 'nftables-ip6-foo-chain-MYCHAIN' |
89 | 97 |
) |
90 | 98 |
} |
91 | 99 |
end |
100 |
|
|
92 | 101 |
context 'with inject set to 22-foobar' do |
93 | 102 |
let(:params) do |
94 | 103 |
{ |
... | ... | |
97 | 106 |
end |
98 | 107 |
|
99 | 108 |
it { is_expected.to contain_nftables__rule('foobar-jump_MYCHAIN') } |
109 |
|
|
100 | 110 |
it { |
101 |
is_expected.to contain_nftables__rule('foobar-jump_MYCHAIN').with(
|
|
111 |
expect(subject).to contain_nftables__rule('foobar-jump_MYCHAIN').with(
|
|
102 | 112 |
order: '22', |
103 | 113 |
content: 'jump MYCHAIN' |
104 | 114 |
) |
105 | 115 |
} |
116 |
|
|
106 | 117 |
context 'with inject_oif set to alpha and inject_oif set to beta' do |
107 | 118 |
let(:params) do |
108 | 119 |
super().merge(inject_iif: 'alpha', inject_oif: 'beta') |
109 | 120 |
end |
110 | 121 |
|
111 | 122 |
it { |
112 |
is_expected.to contain_nftables__rule('foobar-jump_MYCHAIN').with(
|
|
123 |
expect(subject).to contain_nftables__rule('foobar-jump_MYCHAIN').with(
|
|
113 | 124 |
order: '22', |
114 | 125 |
content: 'iifname alpha oifname beta jump MYCHAIN' |
115 | 126 |
) |
Formats disponibles : Unified diff