Fix AttributeError in az load test update when YAML config has null values#33464
Draft
Copilot wants to merge 3 commits into
Draft
Fix AttributeError in az load test update when YAML config has null values#33464Copilot wants to merge 3 commits into
az load test update when YAML config has null values#33464Copilot wants to merge 3 commits into
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
…alues
When a load test YAML config file has properties like 'properties: null',
'loadTestConfiguration: null', 'passFailCriteria: null', or 'autoStopCriteria: null',
the code was using dict.get("key", {}).get("subkey") which returns None (not {})
when the key exists with a None value. This caused AttributeError: 'NoneType' object
has no attribute 'get'.
Fix: Replace .get("key", {}) with (.get("key") or {}) to correctly handle None values.
Also adds unit tests that verify the fix and demonstrate the bug.
Copilot
AI
changed the title
[WIP] Fix NoneType object error in az load test update
Fix AttributeError in May 28, 2026
az load test update when YAML config has null values
Collaborator
|
Fix |
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.
Related command
az load test update --load-test-config-file <yaml>Description
az load test updatecrashes withAttributeError: 'NoneType' object has no attribute 'get'when the YAML config file has null values for dict-type keys (e.g.,properties: null,loadTestConfiguration: null).Root cause:
dict.get("key", {})only uses the default when the key is absent — when the key exists with valuenull/None, it returnsNone, not{}. The subsequent chained.get()then crashes.Changes in
src/load/azext_load/data_plane/utils/utils.py:X.get("key", {}).get("subkey")pattern acrossyaml_data,yaml_test_body,body, andtest_rundictsupload_properties_file_helper(the crash site from the traceback)_update_load_test_configuration,upload_configurations_files_helper,add_defaults_to_test_body, and_get_metrics_from_samplerTesting Guide
Run
az load test updatewith a YAML config file where top-level keys have explicit null values:Before fix: crashes with
AttributeError: 'NoneType' object has no attribute 'get'After fix: command completes successfully
Unit tests added in
src/load/azext_load/tests/latest/test_load_unit_tests.pycovering null properties, absent properties, and valid properties scenarios.History Notes
[Load]
az load test update: Fix crash when YAML config file contains null-valued keys (e.g.,properties: null)This 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.