Skip to content

{CI} Make raw request header test Accept-Encoding resilient#33316

Merged
necusjz merged 1 commit intoAzure:devfrom
YangAn-microsoft:fix/util-test-accept-encoding
May 6, 2026
Merged

{CI} Make raw request header test Accept-Encoding resilient#33316
necusjz merged 1 commit intoAzure:devfrom
YangAn-microsoft:fix/util-test-accept-encoding

Conversation

@YangAn-microsoft
Copy link
Copy Markdown
Contributor

Summary

Updates test_send_raw_requests to avoid asserting an exact Accept-Encoding string, which varies by runtime/compression support (for example Python 3.14 adds zstd).

Root cause

requests/urllib3 now compute default Accept-Encoding based on available codecs.
On Python 3.14, compression.zstd is available, so default headers include zstd, causing strict header dict equality checks to fail.

What changed

  • Added a helper assertion in the test to:
    • verify Accept-Encoding contains required values (gzip, deflate)
    • compare the rest of headers exactly
  • Replaced strict full-header dict equality checks in test_send_raw_requests with the helper

Why 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 3.13:
    • python -m pytest src/azure-cli-core/azure/cli/core/tests/test_util.py -k test_send_raw_requests -q
    • passed
  • Python 3.14:
    • python -m pytest src/azure-cli-core/azure/cli/core/tests/test_util.py -k test_send_raw_requests -q
    • passed

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 5, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 5, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1010 - ParaPropUpdate vm host show cmd vm host show update parameter expand: updated property choices from ['instanceView', 'resiliencyView', 'userData'] to ['instanceView', 'userData']

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 5, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@YangAn-microsoft YangAn-microsoft changed the title [CI] Make raw request header test Accept-Encoding resilient {CI} Make raw request header test Accept-Encoding resilient May 5, 2026
@YangAn-microsoft YangAn-microsoft mentioned this pull request May 5, 2026
9 tasks
@YangAn-microsoft YangAn-microsoft marked this pull request as ready for review May 5, 2026 04:07
Copilot AI review requested due to automatic review settings May 5, 2026 04:07
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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-Encoding contains required encodings (gzip, deflate) without requiring an exact string match.
  • Replaced strict full-header dict equality assertions in test_send_raw_requests with the new helper to avoid brittleness across runtimes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@necusjz necusjz merged commit c3cec7d into Azure:dev May 6, 2026
64 checks passed
@YangAn-microsoft YangAn-microsoft deleted the fix/util-test-accept-encoding branch May 6, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants