generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 11
/
k8s_cmdline_tests.yaml
502 lines (446 loc) · 20.7 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
- 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_subset_label
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--label_subset app:appA --label_subset dep:F
--expected_output expected_cmdline_output_files/basic_subset_label_query_output.txt
expected: 0
- name: subset_label
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--label_subset app:appA,release:v22b --label_subset dep:F,release:v22b
--expected_output expected_cmdline_output_files/subset_label_query_output.txt
expected: 0
- name: subset_label2
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--label_subset app:appA,release:v22bc --label_subset dep:F,release:v22b
--expected_output expected_cmdline_output_files/subset_label2_query_output.txt
expected: 0
- name: basic_subset_deployment
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--deployment_subset deployment-A,deployment-D
--expected_output expected_cmdline_output_files/basic_subset_deployment_query_output.txt
expected: 0
- name: basic_subset_namespace
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--namespace_subset ns1,ns3
--expected_output expected_cmdline_output_files/basic_subset_namespace_query_output.txt
expected: 0
- name: all_subset_mix
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--namespace_subset ns3
--deployment_subset deployment-D
--label_subset app:appA --label_subset dep:F
--expected_output expected_cmdline_output_files/all_subset_mix_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
- name: livesim_test_all_dot
args: >
--connectivity livesim_tests/
--ns_list livesim_tests/
--pod_list livesim_tests/
--output_format dot
--expected_output expected_cmdline_output_files/livesim_test_all_dot.dot
expected: 0
- name: livesim_test_all_txt
args: >
--connectivity livesim_tests/
--ns_list livesim_tests/
--pod_list livesim_tests/
--output_format txt
--expected_output expected_cmdline_output_files/livesim_test_all_txt.txt
expected: 0
- name: helm_test_one_chart
args: >
--connectivity helm_tests/helm_test1/
--ns_list helm_tests/helm_test1/
--pod_list helm_tests/helm_test1/
--expected_output expected_cmdline_output_files/helm_test_one_chart.txt
expected: 0
- name: helm_test_multi_chart
args: >
--connectivity helm_tests/helm_test2/
--ns_list helm_tests/helm_test2/
--pod_list helm_tests/helm_test2/
--expected_output expected_cmdline_output_files/helm_test_multi_chart.txt
expected: 0
- name: helm_test_resolved_yaml_next_to_chart
args: >
--connectivity helm_tests/helm_test3/
--ns_list helm_tests/helm_test3/
--pod_list helm_tests/helm_test3/
--expected_output expected_cmdline_output_files/helm_test_resolved_yaml_next_to_chart.txt
expected: 0
- name: helm_test_resolved_yaml_inside_chart
args: >
--connectivity helm_tests/helm_test4/
--ns_list helm_tests/helm_test4/
--pod_list helm_tests/helm_test4/
--expected_output expected_cmdline_output_files/helm_test_resolved_yaml_inside_chart.txt
expected: 0
- name: helm_test_resolved_yaml_in_template_dir
args: >
--connectivity helm_tests/helm_test5/
--ns_list helm_tests/helm_test5/
--pod_list helm_tests/helm_test5/
--expected_output expected_cmdline_output_files/helm_test_resolved_yaml_in_template_dir.txt
expected: 0
- name: helm_test_resolved_yaml_next_to_multi_charts
args: >
--connectivity helm_tests/helm_test6/
--ns_list helm_tests/helm_test6/
--pod_list helm_tests/helm_test6/
--expected_output expected_cmdline_output_files/helm_test_resolved_yaml_next_to_multi_charts.txt
expected: 0
- name: basic_connectivity_specific_nodes-expl
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--explain default/Pod1[Pod],ns2/deployment-D[Deployment]
-d
--expected_output expected_cmdline_output_files/basic_connectivity_specific_nodes_expl_output.txt
expected: 0
- name: basic_connectivity-expl
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--explain ALL
-d
--expected_output expected_cmdline_output_files/basic_connectivity_expl_output.txt
expected: 0
- name: poc1-expl
args: >
--connectivity fw_rules_tests/policies/microservices-netpols.yaml
--ns_list fw_rules_tests/podlist/poc_ns_list.json
--pod_list fw_rules_tests/podlist/kubernetes-manifests.yaml
--explain ALL
-d
--expected_output expected_cmdline_output_files/poc1_expl_output.txt
expected: 0
- name: subset-deployment-expl
args: >
--connectivity fw_rules_tests/podlist/test_subset_topology.yaml
--ns_list fw_rules_tests/podlist/test_subset_topology.yaml
--pod_list fw_rules_tests/podlist/test_subset_topology.yaml
--deployment_subset deployment-A,deployment-D
--explain ALL
-d
--expected_output expected_cmdline_output_files/subset_deployment_expl_output.txt
expected: 0
- name: test25-expl
args: >
--connectivity fw_rules_tests/policies/test25-networkpolicy.yaml
--ns_list fw_rules_tests/podlist/test_fw_rules_pod_list.yaml
--pod_list fw_rules_tests/podlist/test_fw_rules_pod_list.yaml
--explain ALL
-d
--expected_output expected_cmdline_output_files/test25_expl_output.txt
expected: 0
- name: test4-expl
args: >
--connectivity fw_rules_tests/policies/test4-networkpolicy.yaml
--ns_list fw_rules_tests/podlist/ns_list.json
--pod_list fw_rules_tests/podlist/pods_list_4.json
--explain kube-system-new/calico-node(DaemonSet),0.0.0.0/0
-d
--expected_output expected_cmdline_output_files/test4_expl_output.txt
expected: 0
- name: istio-ingress-expl
args: >
--connectivity istio_testcases/example_policies/istio-ingress-test/resources/
--ns_list istio_testcases/example_policies/istio-ingress-test
--pod_list istio_testcases/example_policies/istio-ingress-test
--explain ALL
-d
# temporarily commenting out expected results, until new Ingress/Egress implementation is completed.
# --expected_output expected_cmdline_output_files/istio-ingress_expl_output.txt
expected: 0
- name: bad-yamls
args: >
--connectivity
-r bad_yamls
expected: 4