Repository navigation
chore(tests): clear ambient AWS env vars in the Mantle and AWS client tests - #2030
Open
alphasafal wants to merge 3 commits into
Open
alphasafal wants to merge 3 commits into
alphasafal wants to merge 3 commits into
Conversation
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Same kind of leak as #2021, in the AWS-side tests.
tests/lib/test_bedrock_mantle.py,test_aws.pyandtest_aws_auth.pydon't clear the environment for every test, so AWS settings exported in your shell reach the clients under test. WithANTHROPIC_BEDROCK_MANTLE_BASE_URLset (e.g. behind a gateway), Mantle requests go to that host instead of the URL the tests mock, andAWS_PROFILE,AWS_REGION/AWS_DEFAULT_REGIONand the API-key variables change the region and auth mode the clients resolve.This adds an autouse fixture to each file that clears the variables those clients read. In
test_aws.pyit reuses the existing_clear_aws_url_envhelper, so there's no second list there. I left the explicit_clear_aws_url_env(...)calls in place to keep the diff small; happy to drop them if you'd prefer.Running the three files with one variable set at a time:
ANTHROPIC_BEDROCK_MANTLE_BASE_URLANTHROPIC_AWS_BASE_URLAWS_PROFILEAWS_DEFAULT_REGIONAWS_REGIONAWS_BEARER_TOKEN_BEDROCKANTHROPIC_AWS_API_KEYThis only changes the tests, so runtime behaviour is untouched. The full
tests/libsuite passes (2462 passed, 20 skipped, 1 xfailed) and./scripts/lintis clean.test_bedrock.pyandtest_vertex.pyhave the same leak, but they build their clients at import time (module-level and class attributes), so a fixture can't reach them. That needs a separate change.