forked from IBM/network-config-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s_cmdline_tests.yaml
302 lines (268 loc) · 13.5 KB
/
k8s_cmdline_tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
- name: basic_sanity
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
--ns_list k8s_testcases/example_podlist/bank_ns_list.json
--pod_list k8s_testcases/example_podlist/bank_pod_list.json
expected: 1
- name: basic_connectivity
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
--expected_output expected_cmdline_output_files/basic_connectivity_txt_query_output.txt
expected: 0
- name: basic_connectivity_txt
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o txt
--expected_output expected_cmdline_output_files/basic_connectivity_txt_query_output.txt
expected: 0
- name: basic_connectivity_yaml
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o yaml
--expected_output expected_cmdline_output_files/basic_connectivity_yaml_query_output.txt
expected: 0
- name: basic_connectivity_csv
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o csv
--expected_output expected_cmdline_output_files/basic_connectivity_csv_query_output.txt
expected: 0
- name: basic_connectivity_md
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o md
--expected_output expected_cmdline_output_files/basic_connectivity_md_query_output.txt
expected: 0
- name: basic_connectivity_dot
args: >
--connectivity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o dot
--expected_output expected_cmdline_output_files/basic_connectivity_dot_query_output.txt
expected: 0
- name: basic_equiv
args: >
--equiv k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: two_way_containment_policies
args: >
--equiv k8s_testcases/example_policies/testcase1/testcase1-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase1/testcase1-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 0
- name: basic_semantic_diff
args: >
--semantic_diff k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
--expected_output expected_cmdline_output_files/basic_semantic_diff_query_output.txt
expected: 1
- name: different_topologies_semantic_diff
args: >
--semantic_diff k8s_testcases/example_policies/tests-different-topologies/policy_b.yaml
--ns_list different_topologies/ns_list_b.json
--pod_list different_topologies/pods_list_b.json
--base_np_list k8s_testcases/example_policies/tests-different-topologies/policy_a.yaml
--base_ns_list different_topologies/ns_list_a.json
--base_pod_list different_topologies/pods_list_a.json
--expected_output expected_cmdline_output_files/different_topologies_semantic_diff_query_output.txt
expected: 1
- name: basic_semantic_diff_yaml
args: >
--semantic_diff k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o yaml
--expected_output expected_cmdline_output_files/basic_semantic_diff_yaml_query_output.txt
expected: 1
- name: basic_semantic_diff_csv
args: >
--semantic_diff k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o csv
--expected_output expected_cmdline_output_files/basic_semantic_diff_csv_query_output.txt
expected: 1
- name: basic_semantic_diff_md
args: >
--semantic_diff k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
-o md
--expected_output expected_cmdline_output_files/basic_semantic_diff_md_query_output.txt
expected: 1
- name: basic_interferes
args: >
--interferes k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 0
- name: basic_forbids
args: >
--forbids k8s_testcases/example_policies/testcase11-forbids-permits/testcase11-within-default.yaml
--base_np_list k8s_testcases/example_policies/testcase11-forbids-permits/testcase11-partly-within-default.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_permits
args: >
--permits k8s_testcases/example_policies/testcase11-forbids-permits/testcase11-within-default.yaml
--base_np_list k8s_testcases/example_policies/testcase11-forbids-permits/testcase11-partly-within-default.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: git_resources
args: >
--sanity k8s_testcases/example_policies/all-captured-tests/some-captured-tests-networkpolicy.yaml
--ns_list https://github.com/IBM/network-config-analyzer/tree/master/tests/example_workload_resources/
--pod_list https://github.com/IBM/network-config-analyzer/tree/master/tests/example_workload_resources/
expected: 0
- name: return_0
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
--return_0
expected: 0
### tests with resources_list combinations:
- name: basic_sanity_ignore_resource_list_np # resource_list will be ignored cause there is a np_list with the query arg
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_used_resource_np # not recommended pattern
args: >
--sanity
--resource_list k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_ignored_resource_list_pods # resource_list will be ignored cause there is a pod_list arg
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/bank_pod_list.json
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_used_resource_pods # not recommended pattern
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/pods_list.json
--ns_list k8s_testcases/example_podlist/ns_list.json
expected: 1
- name: basic_sanity_ignored_resource_ns # resource_list will be ignored cause there is a ns_list arg
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/bank_ns_list.json
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_used_resource_ns # not recommended pattern
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--pod_list k8s_testcases/example_podlist/pods_list.json
--resource_list k8s_testcases/example_podlist/ns_list.json
expected: 1
- name: basic_sanity_ignored_resource_pods_ns # resource_list will be ignored cause there are pod_list and ns_list args
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/bank_pod_list.json
--resource_list k8s_testcases/example_podlist/bank_ns_list.json
--ns_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_ignored_resourcelist_pods # not recommended pattern
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/bank_pod_list.json
--resource_list k8s_testcases/example_podlist/ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_used_resource_pods_ns # read ns and pods from resource-list
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_used_resource_list_only # resource_list is additive
args: >
--sanity
--resource_list k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_sanity_ignore_resource_list_all # resource_list will be ignored
args: >
--sanity k8s_testcases/example_policies/testcase8/testcase8-networkpolicy1.yaml
--resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--ns_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/bank_ns_list.json
--pod_list k8s_testcases/example_podlist/pods_list.json
--resource_list k8s_testcases/example_podlist/bank_pod_list.json
expected: 1
- name: basic_equiv_networkpolicies_and_topology_with_resource_list
args: >
--equiv
--resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_equiv_topology_with_resource_list
args: >
--equiv k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_equiv_base_resource_list_specify_topology
args: >
--equiv k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
--base_resource_list k8s_testcases/example_podlist/ns_list.json
--base_resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_equiv_all_with_resource_list_except_base_np
args: >
--equiv
--resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_np_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1
- name: basic_equiv_all_with_resources_list
args: >
--equiv
--resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy1.yaml
--base_resource_list k8s_testcases/example_policies/testcase7/testcase7-networkpolicy2.yaml
--resource_list k8s_testcases/example_podlist/ns_list.json
--resource_list k8s_testcases/example_podlist/pods_list.json
--base_resource_list k8s_testcases/example_podlist/ns_list.json
--base_resource_list k8s_testcases/example_podlist/pods_list.json
expected: 1