-
Notifications
You must be signed in to change notification settings - Fork 4
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
include sessionCookieEnabled when syncing routes #121
Merged
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ee3e55f
pull sessionCookieEnabled from kube admin api data when syncing routes
rustyjux c9752a1
update test
rustyjux f4ac303
fix test data
rustyjux 5071faa
handle if aps-template-version is not provided
rustyjux 8b8bfa5
debug logging
rustyjux c27782b
update python v in gatewayApi
rustyjux 8eeee61
commit updated lock file
rustyjux 78fcdc3
clean poetry env before tests
rustyjux a0fa63c
revert to 3.11 python for gwa api
ikethecoder d8d9189
revert to 3.11 python for gwa api
ikethecoder 50d68d5
review python env
ikethecoder 41217f6
review python env
ikethecoder ecf71d3
review python env
ikethecoder 8656e18
upd dockerfile to 3.11
ikethecoder 7fdc717
include sessionCookieEnabled in comparison
rustyjux dc2f68e
fix build_ref, add test for sessionCookieEnabled false
rustyjux 3329a79
remove extra debug logging
rustyjux 9699327
return counts for inserted and deleted from routes/sync
rustyjux fabbbb9
restore exception handling
rustyjux e8ac803
only check route name for building delete list
rustyjux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
ikethecoder marked this conversation as resolved.
Show resolved
Hide resolved
|
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
80 changes: 80 additions & 0 deletions
80
microservices/kubeApi/tests/routers/test_bulk_sync_session_cookie.py
ikethecoder marked this conversation as resolved.
Show resolved
Hide resolved
|
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,80 @@ | ||
from unittest import mock | ||
|
||
def test_bulk_sync_session_cookie(client): | ||
with mock.patch("routers.routes.get_gwa_ocp_routes") as call: | ||
call.return_value = [{ | ||
"metadata": { | ||
"name": "wild-ns-example", | ||
"labels": { | ||
"aps-select-tag": "ns.EXAMPLE-NS", | ||
"aps-template-version": "v1" | ||
} | ||
}, | ||
"spec": { | ||
"host": "abc.api.gov.bc.ca", | ||
"to": { | ||
"name": "data-plane-1" | ||
} | ||
} | ||
}] | ||
|
||
with mock.patch("routers.routes.prepare_apply_routes") as call_apply: | ||
call_apply.return_value = 0 | ||
|
||
with mock.patch("routers.routes.apply_routes") as call_mismatch_routes: | ||
call_mismatch_routes.return_value = None | ||
|
||
data = [{ | ||
"name": "wild-ns-example", | ||
"selectTag": "ns.EXAMPLE-NS", | ||
"dataPlane": "data-plane-1", | ||
"host": "abc.api.gov.bc.ca", | ||
"sessionCookieEnabled": True | ||
}] | ||
response = client.post('/namespaces/examplens/routes/sync', json=data) | ||
assert response.status_code == 200 | ||
assert response.json()['message'] == 'synced' | ||
|
||
def test_bulk_sync_session_cookie_change(client): | ||
with mock.patch("routers.routes.get_gwa_ocp_routes") as mock_get_routes: | ||
mock_get_routes.return_value = [{ | ||
"metadata": { | ||
"name": "wild-ns-example", | ||
"labels": { | ||
"aps-select-tag": "ns.EXAMPLE-NS", | ||
"aps-template-version": "v2" | ||
} | ||
}, | ||
"spec": { | ||
"host": "abc.api.gov.bc.ca", | ||
"to": { | ||
"name": "data-plane-1" | ||
} | ||
} | ||
}] | ||
|
||
with mock.patch("routers.routes.prepare_apply_routes") as mock_prepare_apply: | ||
mock_prepare_apply.return_value = 1 | ||
|
||
with mock.patch("routers.routes.apply_routes") as mock_apply_routes: | ||
mock_apply_routes.return_value = None | ||
|
||
with mock.patch("routers.routes.delete_route") as mock_delete_route: | ||
mock_delete_route.return_value = None # Simulate successful deletion | ||
|
||
with mock.patch("routers.routes.kubectl_delete") as mock_kubectl_delete: | ||
mock_kubectl_delete.return_value = None # Simulate successful kubectl deletion | ||
|
||
data = [{ | ||
"name": "wild-ns-example", | ||
"selectTag": "ns.EXAMPLE-NS", | ||
"dataPlane": "data-plane-1", | ||
"host": "abc.api.gov.bc.ca", | ||
"sessionCookieEnabled": True | ||
}] | ||
response = client.post('/namespaces/examplens/routes/sync', json=data) | ||
|
||
assert response.status_code == 200 | ||
assert response.json()['message'] == 'synced' | ||
assert response.json()['inserted_count'] == 1 | ||
assert response.json()['deleted_count'] == 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are you sure it is OK to remove the raising of the SystemExit exception? I think I had to include this otherwise the SIGTERM signal is ignored if the process is in the middle of that code block. So could take longer to terminate the Pod.
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.
My bad - I had removed earlier when trying to resolve errors that came up when deleting a route that doesn't exist (until I saw and modeled off
microservices/kubeApi/tests/routers/test_del_route.py
) and should have restored them.More generally, I should have reviewed all my changes in the commit. Thanks for the catch