-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added some ANP tests from policy-assistant. Fixed a small bug in handling named ports in ANP * fixing lint errors * Fixing lint error * Reorganized testing infrastructure from for tests fro parsed resources - creating pod and namespace resources per test; reading expected results from file. Added more tests from policy assistant. * fixing lint errors * return error if ANPs are without name or not unique names * Revert "return error if ANPs are without name or not unique names" This reverts commit 1805549. * Added ANP/BANP names in tests. Added more tests, including BANP tests, currently commented out. * Fixed lint errors. * Fixed lint errors * Added eval parsed resources tests (along with connlist tests). Moved all parsed resources tests to a separate file. * fixing lint errors * fixing lint errors * Added testing of CheckIfAllowed and CheckIfAllowedNew * fixing lint errors * making linter happy * Reorganized eval ANP tests, to not depend on connlist. * Small fixes. * small fixes * Changed expected results to not use "all but" expressions. * making linter happy * making linter happy * making lint happy * making linter happy * make linter happy * Creating k8sObjects during a test run, rather then in a test creation. * making lint happy * make lint happy * linter * shutting up linter * Moved to parsed_resources_tests some functions used only there. * Added fake pod status IP fields * Avoiding unnecessary exports; Fixing lint errors. * Making linter happy * Update pkg/internal/testutils/parsed_resources_tests.go Co-authored-by: Adi Sosnovich <[email protected]> * Update pkg/internal/testutils/parsed_resources_tests.go Co-authored-by: Adi Sosnovich <[email protected]> * Fixed typos; removed unneeded change. --------- Co-authored-by: shireenf-ibm <[email protected]> Co-authored-by: Adi Sosnovich <[email protected]>
- Loading branch information
1 parent
d3f70e7
commit 0778788
Showing
15 changed files
with
1,578 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
x/a[Pod] => y/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
x/a[Pod] => y/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
x/b[Pod] => y/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
x/b[Pod] => y/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/a[Pod] => x/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/a[Pod] => y/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/b[Pod] => x/b[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 | ||
y/b[Pod] => y/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-79,82-65535 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : SCTP 1-65535,TCP 1-79,81-65535,UDP 1-65535 | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : All Connections | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : All Connections | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : All Connections | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
20 changes: 20 additions & 0 deletions
20
test_outputs/connlist/test1_anp_npv1_conn_from_parsed_res.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : UDP 80 | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : TCP 80-81,UDP 80-81 | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : TCP 80-81,UDP 80-81 | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : TCP 80-81,UDP 80-81 | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,81-65535,UDP 1-65535 | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : All Connections | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : All Connections | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
20 changes: 20 additions & 0 deletions
20
test_outputs/connlist/test2_anp_npv1_conn_from_parsed_res.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : UDP 80 | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : TCP 80-81,UDP 80-81 | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : UDP 80 | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : UDP 80 | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,81-65535,UDP 1-65535 | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : All Connections | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : All Connections | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/c[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/c[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => z/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => z/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => z/c[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => x/c[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/a[Pod] => y/c[Pod] : All Connections | ||
x/a[Pod] => z/a[Pod] : All Connections | ||
x/a[Pod] => z/b[Pod] : All Connections | ||
x/a[Pod] => z/c[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-65535 | ||
x/b[Pod] => x/c[Pod] : All Connections | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => y/c[Pod] : All Connections | ||
x/b[Pod] => z/a[Pod] : All Connections | ||
x/b[Pod] => z/b[Pod] : All Connections | ||
x/b[Pod] => z/c[Pod] : All Connections | ||
x/c[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/c[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-79,82-65535,UDP 1-65535 | ||
x/c[Pod] => x/b[Pod] : All Connections | ||
x/c[Pod] => y/a[Pod] : All Connections | ||
x/c[Pod] => y/b[Pod] : All Connections | ||
x/c[Pod] => y/c[Pod] : All Connections | ||
x/c[Pod] => z/a[Pod] : All Connections | ||
x/c[Pod] => z/b[Pod] : All Connections | ||
x/c[Pod] => z/c[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : All Connections | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => x/c[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => y/c[Pod] : All Connections | ||
y/a[Pod] => z/a[Pod] : All Connections | ||
y/a[Pod] => z/b[Pod] : All Connections | ||
y/a[Pod] => z/c[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : All Connections | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => x/c[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections | ||
y/b[Pod] => y/c[Pod] : All Connections | ||
y/b[Pod] => z/a[Pod] : All Connections | ||
y/b[Pod] => z/b[Pod] : All Connections | ||
y/b[Pod] => z/c[Pod] : All Connections | ||
y/c[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/c[Pod] => x/a[Pod] : All Connections | ||
y/c[Pod] => x/b[Pod] : All Connections | ||
y/c[Pod] => x/c[Pod] : All Connections | ||
y/c[Pod] => y/a[Pod] : All Connections | ||
y/c[Pod] => y/b[Pod] : All Connections | ||
y/c[Pod] => z/a[Pod] : All Connections | ||
y/c[Pod] => z/b[Pod] : All Connections | ||
y/c[Pod] => z/c[Pod] : All Connections | ||
z/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
z/a[Pod] => x/a[Pod] : All Connections | ||
z/a[Pod] => x/b[Pod] : All Connections | ||
z/a[Pod] => x/c[Pod] : All Connections | ||
z/a[Pod] => y/a[Pod] : All Connections | ||
z/a[Pod] => y/b[Pod] : All Connections | ||
z/a[Pod] => y/c[Pod] : All Connections | ||
z/a[Pod] => z/b[Pod] : All Connections | ||
z/a[Pod] => z/c[Pod] : All Connections | ||
z/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
z/b[Pod] => x/a[Pod] : All Connections | ||
z/b[Pod] => x/b[Pod] : All Connections | ||
z/b[Pod] => x/c[Pod] : All Connections | ||
z/b[Pod] => y/a[Pod] : All Connections | ||
z/b[Pod] => y/b[Pod] : All Connections | ||
z/b[Pod] => y/c[Pod] : All Connections | ||
z/b[Pod] => z/a[Pod] : All Connections | ||
z/b[Pod] => z/c[Pod] : All Connections | ||
z/c[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
z/c[Pod] => x/a[Pod] : All Connections | ||
z/c[Pod] => x/b[Pod] : All Connections | ||
z/c[Pod] => x/c[Pod] : All Connections | ||
z/c[Pod] => y/a[Pod] : All Connections | ||
z/c[Pod] => y/b[Pod] : All Connections | ||
z/c[Pod] => y/c[Pod] : All Connections | ||
z/c[Pod] => z/a[Pod] : All Connections | ||
z/c[Pod] => z/b[Pod] : All Connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0.0.0.0-255.255.255.255 => x/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => x/b[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/a[Pod] : All Connections | ||
0.0.0.0-255.255.255.255 => y/b[Pod] : All Connections | ||
x/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/a[Pod] => x/b[Pod] : All Connections | ||
x/a[Pod] => y/a[Pod] : All Connections | ||
x/a[Pod] => y/b[Pod] : All Connections | ||
x/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
x/b[Pod] => x/a[Pod] : All Connections | ||
x/b[Pod] => y/a[Pod] : All Connections | ||
x/b[Pod] => y/b[Pod] : All Connections | ||
y/a[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/a[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-65535,UDP 1-79,81-65535 | ||
y/a[Pod] => x/b[Pod] : All Connections | ||
y/a[Pod] => y/b[Pod] : All Connections | ||
y/b[Pod] => 0.0.0.0-255.255.255.255 : All Connections | ||
y/b[Pod] => x/a[Pod] : SCTP 1-65535,TCP 1-65535,UDP 1-79,81-65535 | ||
y/b[Pod] => x/b[Pod] : All Connections | ||
y/b[Pod] => y/a[Pod] : All Connections |
Oops, something went wrong.