-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-3501 Ensure Auth Environment Variables are Always Dynamic #1107
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
Conversation
| client.get_database().test.find_one() | ||
| self.assertNotEqual(auth.get_cached_credentials(), None) | ||
|
|
||
| def test_environment_variables_ignored(self): |
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.
Is this behavior outlined in the spec? Shouldn't the env vars take precedence even if we already have a previous cached credential?
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.
Discussed in person, this behavior happens because we rely on aws for the credential lookup. The code is like:
if cached_creds:
return cached_creds
creds = get_aws_creds()
if should_cache(creds):
cached_creds = creds
return creds
So if the app is always using env vars then there will never be a cached credential and dynamic env var changes will propagate immediately. However, if the app is using temp creds then later tries to switch to dynamic env var creds, then changes won't propagate until the cached creds are cleared.
|
We updated the spec to clarify that changes to the environment variables should be isolated in case the tests are run in parallel. |
That's fine but I just want to confirm that mock.patch doesn't actually add thread safety to these tests. |
Confirmed. Based on the spec that means we should use unit tests instead, which means those tests will need to go in |
|
I'm confused, I don't think we need to do anything regarding the parallel test issue because we don't run the python tests in parallel. What kind of change are you thinking? |
Yeah that's fair, I'll update the spec a bit to clarify. |
No description provided.