Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one In/outbound list - to set proirity in right order #169

Merged
merged 7 commits into from
Jan 30, 2025

Conversation

haim-kermany
Copy link
Contributor

No description provided.

@haim-kermany haim-kermany requested a review from adisos January 28, 2025 17:20
@haim-kermany haim-kermany marked this pull request as draft January 29, 2025 07:30
@haim-kermany haim-kermany marked this pull request as ready for review January 29, 2025 08:27
@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

started reviewing the examples first, few questions:

  1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
    how can one associate the original example this refers to? and how it should be run? (from cli?)

  2. in pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml policies admin_policy_8 and admin_policy_9 are identical?

@haim-kermany
Copy link
Contributor Author

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical

@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical

can improve the code to avoid generating identical policies? (can be in separate issue/PR)

@haim-kermany
Copy link
Contributor Author

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical

can improve the code to avoid generating identical policies? (can be in separate issue/PR)

I think it should be partof Shiri's optimization, will open an issue for her

@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical
  • can rename the tests to avoid this convention?
  • I still don't follow entirely the tests, their naming are confusing.
    currenrtly there are few main unit tests in this file TestPreprocessing , TestCollectAndConvertToAbstract , TestConvertToAbsract, and TestTmpExpr.
    no test name indicates the e2e translation to k8s policies...
    the functionalities of testing the abstract model, vs comparing the expected policies from e2e generation, should better be separated .

@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical

can improve the code to avoid generating identical policies? (can be in separate issue/PR)

I think it should be partof Shiri's optimization, will open an issue for her

actually they are not identical, one is egress and the other is ingress.
could be merged in one policy, but this can be left to a separate issue.

@haim-kermany
Copy link
Contributor Author

haim-kermany commented Jan 30, 2025

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical
* can rename the tests to avoid this convention?

* I still don't follow entirely the tests, their naming are confusing.
  currenrtly there are few main unit tests in this file `TestPreprocessing`  , `TestCollectAndConvertToAbstract` , `TestConvertToAbsract`, and `TestTmpExpr`.
  no test name indicates the e2e translation to k8s policies...
  the functionalities of testing the abstract model, vs comparing the expected policies from e2e generation, should better be separated .
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.MinCategory(),
	noHint:                false,
},
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.AppCategoty,
	noHint:                false,
},

I thought about renaming the test, but It will not guarantee duplicating tests in the future

@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical
* can rename the tests to avoid this convention?

* I still don't follow entirely the tests, their naming are confusing.
  currenrtly there are few main unit tests in this file `TestPreprocessing`  , `TestCollectAndConvertToAbstract` , `TestConvertToAbsract`, and `TestTmpExpr`.
  no test name indicates the e2e translation to k8s policies...
  the functionalities of testing the abstract model, vs comparing the expected policies from e2e generation, should better be separated .
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.MinCategory(),
	noHint:                false,
},
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.AppCategoty,
	noHint:                false,
},

I thought about renaming the test, but It will not guarantee duplicating tests in the future

can add a method that validates that test names are not duplicated

@haim-kermany
Copy link
Contributor Author

started reviewing the examples first, few questions:

1. what is the convention of `tests_expected_output/<example_name>_<true/false>_0 ?
   how can one associate the original example this refers to? and how it should be run? (from cli?)

2. in `pkg/synthesis/tests_expected_output/k8s_resources/ExampleHogwarts_false_4/policies.yaml` policies admin_policy_8  and admin_policy_9  are identical?
  1. Unfortunately, go allow two tests with the same name. to create a different directory for each test, I uses other test flags for naming the output dir:
    baseName := fmt.Sprintf("%s_%t_%d", synTest.name, synTest.noHint, synTest.allowOnlyFromCategory)
  2. yes, there are two rules - one inbound and one outbound. they are both translated to to two k8s policies, and the translation is identical
* can rename the tests to avoid this convention?

* I still don't follow entirely the tests, their naming are confusing.
  currenrtly there are few main unit tests in this file `TestPreprocessing`  , `TestCollectAndConvertToAbstract` , `TestConvertToAbsract`, and `TestTmpExpr`.
  no test name indicates the e2e translation to k8s policies...
  the functionalities of testing the abstract model, vs comparing the expected policies from e2e generation, should better be separated .
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.MinCategory(),
	noHint:                false,
},
{
	name:                  "ExampleHogwarts",
	exData:                tests.ExampleHogwarts,
	allowOnlyFromCategory: collector.AppCategoty,
	noHint:                false,
},

I thought about renaming the test, but It will not guarantee duplicating tests in the future

can add a method that validates that test names are not duplicated

yes, we can.
please notice that:

  1. this PR is not about thynsesis_test.go.
  2. thynsesis_test.go was created and designed by Shiri, she likes the convention of using the same name to different tests.

@adisos
Copy link
Contributor

adisos commented Jan 30, 2025

ok, let's keep the test re-org for issue #129.

@haim-kermany haim-kermany merged commit 268daed into main Jan 30, 2025
5 checks passed
@haim-kermany haim-kermany deleted the inoutbound-list branch January 30, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants