Révision c82b960a
rubocop:auto_correct results
spec/classes/rules/qemu_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'spec_helper' |
2 | 4 |
|
3 | 5 |
describe 'nftables::rules::qemu' do |
... | ... | |
8 | 10 |
|
9 | 11 |
context 'default options' do |
10 | 12 |
it { is_expected.to compile } |
13 |
|
|
11 | 14 |
it { |
12 |
is_expected.to contain_nftables__rule('default_in-qemu_udp_dns').
|
|
15 |
expect(subject).to contain_nftables__rule('default_in-qemu_udp_dns').
|
|
13 | 16 |
with_content('iifname "virbr0" udp dport 53 accept') |
14 | 17 |
} |
18 |
|
|
15 | 19 |
it { |
16 |
is_expected.to contain_nftables__rule('default_in-qemu_tcp_dns').
|
|
20 |
expect(subject).to contain_nftables__rule('default_in-qemu_tcp_dns').
|
|
17 | 21 |
with_content('iifname "virbr0" tcp dport 53 accept') |
18 | 22 |
} |
23 |
|
|
19 | 24 |
it { |
20 |
is_expected.to contain_nftables__rule('default_in-qemu_dhcpv4').
|
|
25 |
expect(subject).to contain_nftables__rule('default_in-qemu_dhcpv4').
|
|
21 | 26 |
with_content('iifname "virbr0" meta l4proto udp udp dport 67 accept') |
22 | 27 |
} |
28 |
|
|
23 | 29 |
it { |
24 |
is_expected.to contain_nftables__rule('default_fwd-qemu_oip_v4').
|
|
30 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_oip_v4').
|
|
25 | 31 |
with_content('oifname "virbr0" ip daddr 192.168.122.0/24 ct state related,established accept') |
26 | 32 |
} |
33 |
|
|
27 | 34 |
it { |
28 |
is_expected.to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
35 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
29 | 36 |
with_content('iifname "virbr0" ip saddr 192.168.122.0/24 accept') |
30 | 37 |
} |
38 |
|
|
31 | 39 |
it { is_expected.not_to contain_nftables__rule('default_fwd-qemu_oip_v6') } |
32 | 40 |
it { is_expected.not_to contain_nftables__rule('default_fwd-qemu_iip_v6') } |
41 |
|
|
33 | 42 |
it { |
34 |
is_expected.to contain_nftables__rule('default_fwd-qemu_io_internal').
|
|
43 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_io_internal').
|
|
35 | 44 |
with_content('iifname "virbr0" oifname "virbr0" accept') |
36 | 45 |
} |
46 |
|
|
37 | 47 |
it { |
38 |
is_expected.to contain_nftables__rule('POSTROUTING-qemu_ignore_multicast').with(
|
|
48 |
expect(subject).to contain_nftables__rule('POSTROUTING-qemu_ignore_multicast').with(
|
|
39 | 49 |
content: 'ip saddr 192.168.122.0/24 ip daddr 224.0.0.0/24 return', |
40 | 50 |
table: 'ip-nat' |
41 | 51 |
) |
42 | 52 |
} |
53 |
|
|
43 | 54 |
it { |
44 |
is_expected.to contain_nftables__rule('POSTROUTING-qemu_ignore_broadcast').with(
|
|
55 |
expect(subject).to contain_nftables__rule('POSTROUTING-qemu_ignore_broadcast').with(
|
|
45 | 56 |
content: 'ip saddr 192.168.122.0/24 ip daddr 255.255.255.255 return', |
46 | 57 |
table: 'ip-nat' |
47 | 58 |
) |
48 | 59 |
} |
60 |
|
|
49 | 61 |
it { |
50 |
is_expected.to contain_nftables__rule('POSTROUTING-qemu_masq_tcp').with(
|
|
62 |
expect(subject).to contain_nftables__rule('POSTROUTING-qemu_masq_tcp').with(
|
|
51 | 63 |
content: 'meta l4proto tcp ip saddr 192.168.122.0/24 ip daddr != 192.168.122.0/24 masquerade to :1024-65535', |
52 | 64 |
table: 'ip-nat' |
53 | 65 |
) |
54 | 66 |
} |
67 |
|
|
55 | 68 |
it { |
56 |
is_expected.to contain_nftables__rule('POSTROUTING-qemu_masq_udp').with(
|
|
69 |
expect(subject).to contain_nftables__rule('POSTROUTING-qemu_masq_udp').with(
|
|
57 | 70 |
content: 'meta l4proto udp ip saddr 192.168.122.0/24 ip daddr != 192.168.122.0/24 masquerade to :1024-65535', |
58 | 71 |
table: 'ip-nat' |
59 | 72 |
) |
60 | 73 |
} |
74 |
|
|
61 | 75 |
it { |
62 |
is_expected.to contain_nftables__rule('POSTROUTING-qemu_masq_ip').with(
|
|
76 |
expect(subject).to contain_nftables__rule('POSTROUTING-qemu_masq_ip').with(
|
|
63 | 77 |
content: 'ip saddr 192.168.122.0/24 ip daddr != 192.168.122.0/24 masquerade', |
64 | 78 |
table: 'ip-nat' |
65 | 79 |
) |
... | ... | |
99 | 113 |
end |
100 | 114 |
|
101 | 115 |
it { is_expected.to compile } |
116 |
|
|
102 | 117 |
it { |
103 |
is_expected.to contain_nftables__rule('default_fwd-qemu_oip_v4').
|
|
118 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_oip_v4').
|
|
104 | 119 |
with_content('oifname "virbr0" ip daddr 192.168.122.0/24 ct state related,established accept') |
105 | 120 |
} |
121 |
|
|
106 | 122 |
it { |
107 |
is_expected.to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
123 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
108 | 124 |
with_content('iifname "virbr0" ip saddr 192.168.122.0/24 accept') |
109 | 125 |
} |
126 |
|
|
110 | 127 |
it { |
111 |
is_expected.to contain_nftables__rule('default_fwd-qemu_oip_v6').
|
|
128 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_oip_v6').
|
|
112 | 129 |
with_content('oifname "virbr0" ip6 daddr 20ac:cafe:1:1::/64 ct state related,established accept') |
113 | 130 |
} |
131 |
|
|
114 | 132 |
it { |
115 |
is_expected.to contain_nftables__rule('default_fwd-qemu_iip_v6').
|
|
133 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_iip_v6').
|
|
116 | 134 |
with_content('iifname "virbr0" ip6 saddr 20ac:cafe:1:1::/64 accept') |
117 | 135 |
} |
118 | 136 |
end |
... | ... | |
125 | 143 |
end |
126 | 144 |
|
127 | 145 |
it { is_expected.to compile } |
146 |
|
|
128 | 147 |
it { |
129 |
is_expected.to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
148 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
130 | 149 |
with_content('iifname "vfoo0" ip saddr 192.168.122.0/24 accept') |
131 | 150 |
} |
132 | 151 |
end |
... | ... | |
139 | 158 |
end |
140 | 159 |
|
141 | 160 |
it { is_expected.to compile } |
161 |
|
|
142 | 162 |
it { |
143 |
is_expected.to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
163 |
expect(subject).to contain_nftables__rule('default_fwd-qemu_iip_v4').
|
|
144 | 164 |
with_content('iifname "virbr0" ip saddr 172.16.0.0/12 accept') |
145 | 165 |
} |
146 | 166 |
end |
Formats disponibles : Unified diff