-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix bug with container name with spaces #42608
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
…into tvaron3/readMyWrite
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.
Pull Request Overview
This PR fixes a bug where containers with spaces or special characters in their names would incorrectly fall back to eventual consistency instead of using session consistency. The issue occurred because container names were stored without URL encoding in the session container, but were passed URL-encoded when retrieving session tokens.
- Added URL decoding of container paths before session token retrieval
- Added test cases to verify session consistency works with special characters in container names
- Updated import statements to improve organization
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
azure/cosmos/_base.py |
Added URL decoding of paths before session token retrieval to fix the core bug |
tests/test_session.py |
Added synchronous test case for containers with spaces in names |
tests/test_session_async.py |
Added asynchronous test case and reorganized imports |
tests/test_crud_async.py |
Added proper async context manager setup |
CHANGELOG.md |
Documented the bug fix |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Some of our tests were flaky with what seemed like we couldn't read our own write using session consistency. There was a bug where a container named with spaces and other special characters would fall back to eventual consistency because the session container would store container names without url encoding but the container name that is passed in to the session container to set the session token is url encoded.