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

Test for changing parentRef field in policies (AuthPolicy and RateLimitPolicy) #622

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emmaaroche
Copy link

Test for changing parentRef field in policies (AuthPolicy and RateLimitPolicy)

@emmaaroche emmaaroche requested a review from averevki January 21, 2025 14:32
@emmaaroche emmaaroche force-pushed the test-change-parentref branch 2 times, most recently from db28248 to 4dbcc75 Compare January 21, 2025 14:57
@emmaaroche emmaaroche force-pushed the test-change-parentref branch from 4dbcc75 to 5edc14b Compare January 27, 2025 15:20
Signed-off-by: emmaaroche <[email protected]>
@emmaaroche emmaaroche force-pushed the test-change-parentref branch from b807697 to d66e9b5 Compare January 31, 2025 16:59

response = client.get("/get", auth=auth)
assert response.status_code == 200

Copy link
Contributor

Choose a reason for hiding this comment

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

Check also that requests won't go through without the auth, and authpolicy is truly enforced. You can also verify that second gateway is not protected by authpolicy before you switch it.

responses = client.get_many("/get", 5, auth=auth)
responses.assert_all(status_code=200)
assert client.get("/get", auth=auth).status_code == 429

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, you could check that second gateway is not limiting any requests before you switch it

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a lot of code duplicity in these tests. I'm wondering if we can create a separate package with its own conftest for this. You can put duplicate fixtures there.

In the future we will need to create the same tests for DNS and TLS policies, so they can go to the same place.

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.

2 participants