-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add tests for changing targetRef field in policies #641
base: main
Are you sure you want to change the base?
Conversation
...ts/singlecluster/gateway/reconciliation/change_targetref/test_update_tlspolicy_target_ref.py
Outdated
Show resolved
Hide resolved
...ts/singlecluster/gateway/reconciliation/change_targetref/test_update_tlspolicy_target_ref.py
Outdated
Show resolved
Hide resolved
testsuite/tests/singlecluster/gateway/reconciliation/change_targetref/conftest.py
Outdated
Show resolved
Hide resolved
testsuite/tests/singlecluster/gateway/reconciliation/change_targetref/conftest.py
Outdated
Show resolved
Hide resolved
...ts/singlecluster/gateway/reconciliation/change_targetref/test_update_dnspolicy_target_ref.py
Outdated
Show resolved
Hide resolved
...ts/singlecluster/gateway/reconciliation/change_targetref/test_update_dnspolicy_target_ref.py
Outdated
Show resolved
Hide resolved
...ts/singlecluster/gateway/reconciliation/change_targetref/test_update_tlspolicy_target_ref.py
Outdated
Show resolved
Hide resolved
Signed-off-by: emmaaroche <[email protected]>
895c6e6
to
8e86700
Compare
client2 = hostname2.client() | ||
|
||
response = client2.get("/get") | ||
assert not response.has_cert_verify_error() | ||
assert not response.has_dns_error() | ||
assert response.status_code == 200 | ||
|
||
client2.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can put second client in a separate fixture so you don't have to close it inside the test. Check out usage of yield
in the pytest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, I chose to initialize client2 only after the targetRef change to ensure the TLS secret is available. When using a separate client2 fixture, errors occurred due to missing TLS certificates.
response = client.get("/get") | ||
assert not response.has_cert_verify_error() | ||
assert not response.has_dns_error() | ||
assert response.status_code == 200 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also verify that second gateway is not affected by tls/dns policies with requests before the change. Statuses change you asserted above isn't enough, it may show that it's not affected but be different in practice
response = client2.get("/get") | ||
assert not response.has_cert_verify_error() | ||
assert not response.has_dns_error() | ||
assert response.status_code == 200 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same but with the first gateway. Check that it's not affected anymore
Summary
This PR adds reconciliation tests focusing on targetRef updates across different policies.
Test Cases Covered
targetRef
from Gateway 1 (hostname 1) to Gateway 2 (hostname 2).targetRef
from Gateway 1 (hostname 1) to Gateway 2 (hostname 2).Additional Notes
testsuite/tests/singlecluster/gateway/reconciliation/change_targetref/conftest.py
to use TLSGatewayListener instead of GatewayListener.testsuite/tests/singlecluster/gateway/reconciliation/change_targetref/conftest.py
.Related Issue
Closes #307