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.
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
feat: invalidate cache on bad connection info and failed IP lookup #389
base: main
Are you sure you want to change the base?
feat: invalidate cache on bad connection info and failed IP lookup #389
Changes from 6 commits
01cc3aa
e4537a5
4519cdf
f0325ac
a1ce813
866b8e2
93ca9a1
cd00cc5
396d5a5
f06af27
8efac50
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
can we not just use the
fake_client
fixture for these tests?alloydb-python-connector/tests/unit/conftest.py
Lines 42 to 43 in e682102
The connector should just use the cache's client, i don't think we need to override the
connector._client
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.
From what I'm observing: if I change a member variable of a fixture object, it affects other test cases that are run in the session.
For example, if
test_Connector_remove_cached_bad_instance
is run right beforetest_connect
in a test session, and if I do something likefake_client.instance.name = "bad-test-instace"
intest_Connector_remove_cached_bad_instance
, this will also be propagated totest_connect
.So that's why I'm not using the fixture here. Because I was seeing similar behavior when running
nox -s unit-3.11
.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.
@rhatgadkar-goog you do not need to change any of the
fake_client.instance
attributes... since you do not need the bad-instance to be aFakeInstance
it should give a 404 without needing it...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.
Ok, I did this for
test_Connector_remove_cached_bad_instance
. I think I still need to initialize aFakeAlloyDBClient
fortest_Connector_remove_cached_no_ip_type
to override the instance's IP address and to not send an actual API request.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 here and below spots, can we not use the
fake_client
fixture?