{Test} Update the response processing in EmailAddressReplacer#31677
{Test} Update the response processing in EmailAddressReplacer#31677
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @FumingZhang, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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>
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the conversion process of bytes to strings to handle binary files that cannot be decoded in UTF-8. It adds a try/except block in the _byte_to_str function and includes an additional type check in process_response to ensure only strings are manipulated.
| except UnicodeDecodeError: | ||
| pass |
There was a problem hiding this comment.
[nitpick] Consider logging the UnicodeDecodeError in the _byte_to_str function (inside the try/except block) to facilitate debugging of unexpected binary content issues.
| except UnicodeDecodeError: | |
| pass | |
| except UnicodeDecodeError as e: | |
| import logging | |
| logging.error(f"Failed to decode bytes: {byte_or_str}. Error: {e}") |
|
@jiasli, @evelyn-ys could you please help take a look? |
Related command
Description
{Test} Update the response processing in EmailAddressReplacer. In some scenario tests, we may download some binary files, which cannot be converted to utf8-encoded strings, resulting in errors. Related to #31262.
The following is a sample error when running test case test_aks_install_kubectl, which downloads the binary kubectl
https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=127765187&view=logs&j=b162b355-d59d-5864-ce0f-0a70f12dd28b&t=dc59ccd1-231f-538b-777f-33a592c7ca57&l=2729
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.