{CI} Make raw request header test Accept-Encoding resilient#33316
{CI} Make raw request header test Accept-Encoding resilient#33316
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vm host show | cmd vm host show update parameter expand: updated property choices from ['instanceView', 'resiliencyView', 'userData'] to ['instanceView', 'userData'] |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure CLI core test suite to make test_send_raw_requests resilient to runtime- and dependency-specific variations in the default Accept-Encoding header (e.g., Python 3.14 adding zstd), while keeping strict verification for CLI-controlled headers and request composition.
Changes:
- Added a test helper to assert
Accept-Encodingcontains required encodings (gzip,deflate) without requiring an exact string match. - Replaced strict full-header dict equality assertions in
test_send_raw_requestswith the new helper to avoid brittleness across runtimes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Updates
test_send_raw_requeststo avoid asserting an exactAccept-Encodingstring, which varies by runtime/compression support (for example Python 3.14 addszstd).Root cause
requests/urllib3now compute defaultAccept-Encodingbased on available codecs.On Python 3.14,
compression.zstdis available, so default headers includezstd, causing strict header dict equality checks to fail.What changed
Accept-Encodingcontains required values (gzip,deflate)test_send_raw_requestswith the helperWhy this is correct
This keeps strict validation of CLI-owned behavior (
User-Agent, telemetry headers, auth headers, URL/body handling) while removing brittle coupling to dependency/runtime-specific transport defaults.Validation
python -m pytest src/azure-cli-core/azure/cli/core/tests/test_util.py -k test_send_raw_requests -qpython -m pytest src/azure-cli-core/azure/cli/core/tests/test_util.py -k test_send_raw_requests -q