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

Update 'identical hostname' tests since the behavior has changed #599

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

trepel
Copy link
Contributor

@trepel trepel commented Nov 20, 2024

Overview

The 'identical hostname' limitation is no longer there. It should work the same as if the hostnames were not identical.

What was done

Removed the *_desired.py tests since the desired behavior is now validated by the remaining tests. These tests were moved to auth and rlp directories and updated so that they validates the expected behavior and not the behavior with 'identical hostname' limitation.

Verification Steps

make ./testsuite/tests/singlecluster/identical_hostnames

All four tests should pass

Copy link
Contributor

@averevki averevki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally, looks good 👍. Only few comments

@trepel trepel force-pushed the identical-hostname-test-updates branch from 9ab2189 to 63291a5 Compare November 21, 2024 07:05
@trepel
Copy link
Contributor Author

trepel commented Nov 21, 2024

@averevki Thanks for review! Your suggestions have been force pushed. Could you please take a look if you get a chance?



@pytest.fixture(scope="module")
def rate_limit():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common practice across testsuite is creating new commit fixtures, with objects you want to create. In this case just authorization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in theory this can be removed I assume. I have a commit fixture defined in the test files directly and RLP is not committed there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it indeed can be removed. Will force push and let you know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsmolar force-pushed now



@pytest.fixture(scope="module", autouse=True)
def commit(request, authorization, authorization2):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixture should be in auth conftest. The same applies for commit in test_identical_hostnames_auth_on_routes.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixture is slightly different for each test. In 'on route' scenario both auth policies are fully enforced whereas in 'on gw' scenario the 2nd authpolicy (the one attached to GW rather than HTTPRoute) is overridden.
It did not occur to me how to handle this difference nicely in the fixture so that it can be used for both tests, that is the reason why I placed it in the test file rather than conftest. Suggestions welcome!



@pytest.fixture(scope="module")
def authorization2(route2, blame, cluster, label):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be in auth conftest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. For one test this auth policy is attached to HTTPRoute, for the other it is attached to GW. Again, not sure how to handle this nicely so that it can be shared in both tests.

@jsmolar
Copy link
Contributor

jsmolar commented Nov 21, 2024

Great test rewrite! To sum up my comments here. Please move authorization2, rate_limit2, and commit to conftests.
In addition, python package where these tests are located is called identical_hostnames. There is no need to include this into test name.

@trepel
Copy link
Contributor Author

trepel commented Nov 25, 2024

Great test rewrite! To sum up my comments here. Please move authorization2, rate_limit2, and commit to conftests. In addition, python package where these tests are located is called identical_hostnames. There is no need to include this into test name.

The names of test functions are not ideal, a lot of duplicit info there, I agree. The reason I have it this way is that it helps to identify the test in the report portal. RP only shows test function name, that's why it is this long. However, you are right that 'identical_hostnames' is redundant in the name of the test files. I will rename.

@trepel trepel force-pushed the identical-hostname-test-updates branch from fbd9260 to 430cc7a Compare November 25, 2024 13:03
@trepel trepel requested a review from jsmolar November 26, 2024 06:57
@jsmolar jsmolar merged commit 7eebf6a into Kuadrant:main Nov 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants