Révision c3515492
Add newline & more tests
spec/classes/rules/docker_ce_spec.rb | ||
---|---|---|
31 | 31 |
table: 'ip-nat', |
32 | 32 |
) |
33 | 33 |
} |
34 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_1-iifname').with_content('iifname "docker0" oifname != "docker0" counter jump DOCKER_ISOLATION_STAGE_2') } |
|
35 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_1-counter').with_content('counter return') } |
|
34 | 36 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_2-drop').with_content('oifname "docker0" counter drop') } |
37 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_2-counter').with_content('counter return') } |
|
38 |
it { is_expected.to contain_nftables__rule('DOCKER_USER-counter').with_content('counter return') } |
|
39 |
it { is_expected.to contain_nftables__rule('default_fwd-jump_docker_user').with_content('counter jump DOCKER_USER') } |
|
40 |
it { is_expected.to contain_nftables__rule('default_fwd-jump_docker_isolation_stage_1').with_content('counter jump DOCKER_ISOLATION_STAGE_1') } |
|
41 |
it { is_expected.to contain_nftables__rule('default_fwd-out_docker_accept').with_content('oifname "docker0" ct state established,related counter accept') } |
|
42 |
it { is_expected.to contain_nftables__rule('default_fwd-jump_docker').with_content('oifname "docker0" counter jump DOCKER') } |
|
43 |
it { is_expected.to contain_nftables__rule('default_fwd-idocker_onot_accept').with_content('iifname "docker0" oifname != "docker0" counter accept') } |
|
44 |
it { is_expected.to contain_nftables__rule('default_fwd-idocker_odocker_accept').with_content('iifname "docker0" oifname "docker0" counter accept') } |
|
45 |
|
|
35 | 46 |
it { |
36 | 47 |
is_expected.to contain_nftables__rule('POSTROUTING-docker').with( |
37 | 48 |
content: 'oifname != "docker0" ip saddr 172.17.0.0/16 counter masquerade', |
38 | 49 |
table: 'ip-nat', |
39 | 50 |
) |
40 | 51 |
} |
52 |
it { |
|
53 |
is_expected.to contain_nftables__rule('PREROUTING-docker').with( |
|
54 |
content: 'fib daddr type local counter jump DOCKER', |
|
55 |
table: 'ip-nat', |
|
56 |
) |
|
57 |
} |
|
58 |
it { |
|
59 |
is_expected.to contain_nftables__rule('OUTPUT-jump_docker@ip-nat').with( |
|
60 |
rule_name: 'OUTPUT-jump_docker' |
|
61 |
content: 'ip daddr != 127.0.0.0/8 fib daddr type local counter jump DOCKER', |
|
62 |
table: 'ip-nat', |
|
63 |
) |
|
64 |
} |
|
65 |
it { |
|
66 |
is_expected.to contain_nftables__rule('DOCKER-counter').with( |
|
67 |
content: 'iifname "docker0" counter return', |
|
68 |
table: 'ip-nat', |
|
69 |
) |
|
70 |
} |
|
71 |
it { |
|
72 |
is_expected.to contain_nftables__rule('INPUT-type@ip-nat').with( |
|
73 |
rulename: 'INPUT-type' |
|
74 |
content: 'type nat hook input priority 100', |
|
75 |
table: 'ip-nat', |
|
76 |
) |
|
77 |
} |
|
78 |
it { |
|
79 |
is_expected.to contain_nftables__rule('INPUT-policy@ip-nat').with( |
|
80 |
rulename: 'INPUT-policy' |
|
81 |
content: 'policy accept', |
|
82 |
table: 'ip-nat', |
|
83 |
) |
|
84 |
} |
|
41 | 85 |
end |
42 | 86 |
|
43 | 87 |
context 'with custom interface and subnet' do |
... | ... | |
49 | 93 |
end |
50 | 94 |
|
51 | 95 |
it { is_expected.to compile } |
96 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_1-iifname').with_content('iifname "ifdo0" oifname != "ifdo0" counter jump DOCKER_ISOLATION_STAGE_2') } |
|
52 | 97 |
it { is_expected.to contain_nftables__rule('DOCKER_ISOLATION_STAGE_2-drop').with_content('oifname "ifdo0" counter drop') } |
98 |
it { is_expected.to contain_nftables__rule('default_fwd-out_docker_accept').with_content('oifname "ifdo0" ct state established,related counter accept') } |
|
99 |
it { is_expected.to contain_nftables__rule('default_fwd-jump_docker').with_content('oifname "ifdo0" counter jump DOCKER') } |
|
100 |
it { is_expected.to contain_nftables__rule('default_fwd-idocker_onot_accept').with_content('iifname "ifdo0" oifname != "ifdo0" counter accept') } |
|
101 |
it { is_expected.to contain_nftables__rule('default_fwd-idocker_odocker_accept').with_content('iifname "ifdo0" oifname "ifdo0" counter accept') } |
|
102 |
|
|
53 | 103 |
it { |
54 | 104 |
is_expected.to contain_nftables__rule('POSTROUTING-docker').with( |
55 | 105 |
content: 'oifname != "ifdo0" ip saddr 192.168.4.0/24 counter masquerade', |
56 | 106 |
table: 'ip-nat', |
57 | 107 |
) |
58 | 108 |
} |
109 |
it { |
|
110 |
is_expected.to contain_nftables__rule('DOCKER-counter').with( |
|
111 |
content: 'iifname "ifdo0" counter return', |
|
112 |
table: 'ip-nat', |
|
113 |
) |
|
114 |
} |
|
59 | 115 |
end |
60 | 116 |
end |
61 | 117 |
end |
62 |
end |
|
118 |
end |
Formats disponibles : Unified diff