Skip to content

Fix AttributeError in az load test update when YAML config has null values#33464

Draft
Copilot wants to merge 3 commits into
devfrom
copilot/resolve-nonetype-error-az-load-test-update
Draft

Fix AttributeError in az load test update when YAML config has null values#33464
Copilot wants to merge 3 commits into
devfrom
copilot/resolve-nonetype-error-az-load-test-update

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Related command
az load test update --load-test-config-file <yaml>

Description

az load test update crashes with AttributeError: '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 value null/None, it returns None, not {}. The subsequent chained .get() then crashes.

# YAML: properties: null
yaml_data.get("properties", {}).get("userPropertyFile")  # → AttributeError

# Fix: or {} coerces None to {} before the second .get()
(yaml_data.get("properties") or {}).get("userPropertyFile")  # → None (safe)

Changes in src/load/azext_load/data_plane/utils/utils.py:

  • Fixed 16 occurrences of the X.get("key", {}).get("subkey") pattern across yaml_data, yaml_test_body, body, and test_run dicts
  • Primary fix in upload_properties_file_helper (the crash site from the traceback)
  • Additional fixes in _update_load_test_configuration, upload_configurations_files_helper, add_defaults_to_test_body, and _get_metrics_from_sampler

Testing Guide

Run az load test update with a YAML config file where top-level keys have explicit null values:

# jmeter-loadtest.config.yaml
version: v0.1
testId: my-test
displayName: My Test
properties: null
loadTestConfiguration: null

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.py covering 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.

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

azure-client-tools-bot-prd Bot commented May 28, 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 28, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

Copilot AI linked an issue May 28, 2026 that may be closed by this pull request
Copilot AI added 2 commits May 28, 2026 10:06
…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 az load test update when YAML config has null values May 28, 2026
Copilot finished work on behalf of a0x1ab May 28, 2026 10:08
Copilot AI requested a review from a0x1ab May 28, 2026 10:08
@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 28, 2026

Fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'NoneType' object has no attribute 'get' using az load test update

3 participants