Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4230ce1
[load] support multi-region load test configuration
mbhardwaj-msft Nov 28, 2024
e2f9857
merge latest main
mbhardwaj-msft Nov 28, 2024
6dbc06e
refactor
mbhardwaj-msft Nov 28, 2024
fc572c0
update recordings
mbhardwaj-msft Nov 28, 2024
67b0ea0
azdev style load
mbhardwaj-msft Nov 28, 2024
2036fc4
refactor yaml keys to constants file
mbhardwaj-msft Nov 28, 2024
5141df3
refactor test load test
mbhardwaj-msft Nov 28, 2024
7fdecd5
update recordings
mbhardwaj-msft Nov 28, 2024
441b5ec
azdev style load
mbhardwaj-msft Nov 28, 2024
293de07
update help text
mbhardwaj-msft Nov 29, 2024
6864806
update help text
mbhardwaj-msft Nov 29, 2024
d7f576b
action on comments
mbhardwaj-msft Nov 29, 2024
889b1a9
refactor test regional-load autostop
mbhardwaj-msft Nov 29, 2024
46cdd85
check for valid region names client-side
mbhardwaj-msft Dec 2, 2024
68e8f40
[load] support advanced url tests
mbhardwaj-msft Dec 2, 2024
25283f6
action on comments
mbhardwaj-msft Dec 3, 2024
8029f70
action on comments
mbhardwaj-msft Dec 3, 2024
bc649e1
action on comments
mbhardwaj-msft Dec 3, 2024
3045740
update recordings
mbhardwaj-msft Dec 3, 2024
6766bd3
action on comments
mbhardwaj-msft Dec 4, 2024
88a3091
update test and recordings
mbhardwaj-msft Dec 4, 2024
862727f
refactor test exception scenarios
mbhardwaj-msft Dec 4, 2024
df7e056
azdev style load
mbhardwaj-msft Dec 4, 2024
8a1e1ec
Merge pull request #1 from mbhardwaj-msft/mbhardwaj/azload-20241202
mbhardwaj-msft Dec 5, 2024
63f020a
[load] dashboard reports | debug mode | copy artifacts sas url
mbhardwaj-msft Dec 5, 2024
ac1aaab
action on comments
mbhardwaj-msft Dec 6, 2024
06b47c3
update recordings
mbhardwaj-msft Dec 6, 2024
f725e14
set copy artifacts ut live-only
mbhardwaj-msft Dec 6, 2024
d63c746
Merge pull request #2 from mbhardwaj-msft/mbhardwaj/azload-20241205
mbhardwaj-msft Dec 9, 2024
e9d4744
change copy-artifacts to get-artifacts
mbhardwaj-msft Dec 9, 2024
ad7444a
update recordings
mbhardwaj-msft Dec 9, 2024
05085ac
Merge branch 'main' of https://github.com/mbhardwaj-msft/azure-cli-ex…
mbhardwaj-msft Dec 9, 2024
e36a2ba
[load] download-files high scale test update console message
mbhardwaj-msft Dec 9, 2024
5e015cb
[load] download-files high scale test update console message
mbhardwaj-msft Dec 10, 2024
6ca56c1
remove unused import
mbhardwaj-msft Dec 10, 2024
e7c049a
update texts
mbhardwaj-msft Dec 10, 2024
3db9e03
update texts
mbhardwaj-msft Dec 10, 2024
59ca975
Merge pull request #3 from mbhardwaj-msft/mbhardwaj/azload-20241209
mbhardwaj-msft Dec 10, 2024
213725e
[load] convert test to jmx
mbhardwaj-msft Dec 13, 2024
d5e2a61
update comment
mbhardwaj-msft Dec 13, 2024
7e4ad6d
update prompt text
mbhardwaj-msft Dec 16, 2024
7d9d523
Merge pull request #4 from mbhardwaj-msft/mbhardwaj/azload-20241212
mbhardwaj-msft Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/load/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

Release History
===============
1.4.0
++++++
* Add support for multi-region load test configuration. Multi-region load test configuration can be set using `--regionwise-engines` argument in 'az load test create' and 'az load test update' commands. Multi-region load test configuration set in YAML config file under key `regionalLoadTestConfig` will also be honoured.
* Bug fix for `engineInstances` being reset to 1 and not getting backfilled using test's existing configuration when engine instances are not explicitly specified either in YAML config file or CLI argument.
* Add support for advanced URL test with multiple HTTP request using JSON file. Add `--test-type` argument to 'az load test create' and honor `testType` key in YAML config file.
* Add CLI parameter `--report` to 'az load test-run download-files' to download the dashboard reports.
* Enable debug level logging using `--debug-mode` argument in 'az load test-run create' command .
* Return the SAS URL to copy artifacts to storage accounts using command 'az load test-run get-artifacts-url'.
* Add config for high-scale load tests and appropriate messaging in the 'az load test-run download-files' command for such tests.
* Add command 'az load test convert-to-jmx' to convert URL type tests to JMX tests.


1.3.1
++++++
* Bug fix for `splitAllCSVs` not being honoured from config file due to CLI argument being set as false by default leading to configuration not being selected from the config file.
Expand Down
6 changes: 6 additions & 0 deletions src/load/azext_load/data_plane/load_test/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------

from azext_load.data_plane.utils import validators
from azext_load.data_plane.utils.constants import LoadCommandsConstants
from azure.cli.core.commands import CliCommandType

admin_custom_sdk = CliCommandType(
Expand All @@ -25,6 +26,11 @@ def load_test_commands(self, _):
"download_test_files",
validator=validators.validate_download,
)
g.custom_command(
"convert-to-jmx",
"convert_to_jmx",
confirmation=LoadCommandsConstants.CONVERT_TO_JMX_CONFIRM_PROMPT
)

with self.command_group(
"load test app-component",
Expand Down
60 changes: 52 additions & 8 deletions src/load/azext_load/data_plane/load_test/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
upload_files_helper,
create_autostop_criteria_from_args,
)
from azure.cli.core.azclierror import InvalidArgumentValueError
from azext_load.data_plane.utils.models import (
AllowedTestTypes,
)
from azure.cli.core.azclierror import InvalidArgumentValueError, FileOperationError
from azure.core.exceptions import ResourceNotFoundError
from knack.log import get_logger

Expand All @@ -31,6 +34,7 @@ def create_test(
test_id,
display_name=None,
test_plan=None,
test_type=None,
resource_group_name=None,
load_test_config_file=None,
test_description=None,
Expand All @@ -46,6 +50,7 @@ def create_test(
autostop=None,
autostop_error_rate=None,
autostop_error_rate_time_window=None,
regionwise_engines=None,
):
client = get_admin_data_plane_client(cmd, load_test_resource, resource_group_name)
logger.info("Create test has started for test ID : %s", test_id)
Expand All @@ -68,6 +73,7 @@ def create_test(
body,
display_name=display_name,
test_description=test_description,
test_type=test_type,
engine_instances=engine_instances,
env=env,
secrets=secrets,
Expand All @@ -77,15 +83,17 @@ def create_test(
split_csv=split_csv,
disable_public_ip=disable_public_ip,
autostop_criteria=autostop_criteria,
regionwise_engines=regionwise_engines,
)
else:
yaml = load_yaml(load_test_config_file)
yaml_test_body = convert_yaml_to_test(yaml)
yaml_test_body = convert_yaml_to_test(cmd, yaml)
body = create_or_update_test_with_config(
test_id,
body,
yaml_test_body,
display_name=display_name,
test_type=test_type,
test_description=test_description,
engine_instances=engine_instances,
env=env,
Expand All @@ -95,16 +103,18 @@ def create_test(
subnet_id=subnet_id,
split_csv=split_csv,
disable_public_ip=disable_public_ip,
autostop_criteria=autostop_criteria
autostop_criteria=autostop_criteria,
regionwise_engines=regionwise_engines,
)
logger.debug("Creating test with test ID: %s and body : %s", test_id, body)
response = client.create_or_update_test(test_id=test_id, body=body)
logger.debug(
"Created test with test ID: %s and response obj is %s", test_id, response
)
logger.info("Uploading files to test %s", test_id)
evaluated_test_type = test_type or yaml_test_body.get("kind") if yaml_test_body else response.get("kind")
upload_files_helper(
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait, evaluated_test_type
)
response = client.get_test(test_id)
logger.info("Upload files to test %s has completed", test_id)
Expand Down Expand Up @@ -133,6 +143,7 @@ def update_test(
autostop=None,
autostop_error_rate=None,
autostop_error_rate_time_window=None,
regionwise_engines=None,
):
client = get_admin_data_plane_client(cmd, load_test_resource, resource_group_name)
logger.info("Update test has started for test ID : %s", test_id)
Expand All @@ -149,7 +160,7 @@ def update_test(
autostop=autostop, error_rate=autostop_error_rate, time_window=autostop_error_rate_time_window)
if load_test_config_file is not None:
yaml = load_yaml(load_test_config_file)
yaml_test_body = convert_yaml_to_test(yaml)
yaml_test_body = convert_yaml_to_test(cmd, yaml)
body = create_or_update_test_with_config(
test_id,
body,
Expand All @@ -164,7 +175,8 @@ def update_test(
subnet_id=subnet_id,
split_csv=split_csv,
disable_public_ip=disable_public_ip,
autostop_criteria=autostop_criteria
autostop_criteria=autostop_criteria,
regionwise_engines=regionwise_engines,
)
else:
body = create_or_update_test_without_config(
Expand All @@ -180,7 +192,8 @@ def update_test(
subnet_id=subnet_id,
split_csv=split_csv,
disable_public_ip=disable_public_ip,
autostop_criteria=autostop_criteria
autostop_criteria=autostop_criteria,
regionwise_engines=regionwise_engines,
)
logger.info("Updating test with test ID: %s", test_id)
response = client.create_or_update_test(test_id=test_id, body=body)
Expand All @@ -189,7 +202,7 @@ def update_test(
)
logger.info("Uploading files to test %s", test_id)
upload_files_helper(
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait, body.get("kind")
)
response = client.get_test(test_id)
logger.info("Upload files to test %s has completed", test_id)
Expand Down Expand Up @@ -262,6 +275,33 @@ def delete_test(
logger.info("Deleted test with test ID: %s", test_id)


def convert_to_jmx(
cmd,
load_test_resource,
test_id,
resource_group_name=None,
):
logger.info("Converting test with test ID: %s to JMX", test_id)
client = get_admin_data_plane_client(cmd, load_test_resource, resource_group_name)
existing_test = client.get_test(test_id)
if (
existing_test is not None
and existing_test.get("kind") != AllowedTestTypes.URL.value
):
raise InvalidArgumentValueError(
f"Test with test ID: {test_id} is not of type URL. "
"Only URL type tests can be converted to JMX."
)
body = create_or_update_test_without_config(
test_id=test_id,
body=existing_test,
test_type=AllowedTestTypes.JMX.value,
)
response = client.create_or_update_test(test_id=test_id, body=body)
logger.debug("Converted test with test ID: %s to JMX", test_id)
return response.as_dict()


def add_test_app_component(
cmd,
load_test_resource,
Expand Down Expand Up @@ -403,6 +443,10 @@ def upload_test_file(
response = upload_file_to_test(
client, test_id, path, file_type=file_type, wait=not no_wait
)
if not no_wait and response is not None and response.get("validationStatus") == "VALIDATION_FAILURE":
raise FileOperationError(
f"File upload failed due to validation failure: {response.get('validationFailureDetails')}"
)
logger.debug("Upload test file response: %s", response)
logger.info("Upload test file completed")
return response.as_dict()
Expand Down
26 changes: 26 additions & 0 deletions src/load/azext_load/data_plane/load_test/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --autostop-error-rate 80.5 --autostop-time-window 120
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --autostop disable
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --autostop enable
- name: Create a test with a multi-region load configuration using region names in the format accepted by Azure Resource Manager (ARM). Ensure the specified regions are supported by Azure Load Testing. Multi-region load tests are restricted to public endpoints only.
text: |
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --engine-instances 3 --regionwise-engines eastus=1 westus2=1 germanywestcentral=1 --test-plan sample-jmx.jmx
- name: Create an advanced URL test with multiple HTTP requests using a JSON file.
text: |
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --test-plan ~/resources/sample-url-requests.json --test-type URL
"""

helps[
Expand Down Expand Up @@ -82,6 +88,12 @@
- name: Update the Key Vault reference identity to system assigned Managed Identity.
text: |
az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --keyvault-reference-id null
- name: Update autostop criteria.
text: |
az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --autostop-error-rate 90 --autostop-time-window 180
- name: Update multi-region load configuration.
text: |
az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --engine-instances 5 --regionwise-engines eastus=2 westus2=1 eastasia=2
"""

helps[
Expand All @@ -95,6 +107,17 @@
az load test delete --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id
"""

helps[
"load test convert-to-jmx"
] = """
type: command
short-summary: Convert a URL type test to JMX test.
examples:
- name: Convert to JMX test.
text: |
az load test convert-to-jmx --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id
"""

helps[
"load test download-files"
] = """
Expand Down Expand Up @@ -234,4 +257,7 @@
- name: Upload zipped artifacts to a test.
text: |
az load test file upload --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --path ~/Resources/sample-zip.zip --file-type ZIPPED_ARTIFACTS
- name: Upload URL requests JSON configuration file to a test which is of type URL.
text: |
az load test file upload --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --path ~/Resources/sample-url-requests.json --file-type URL_TEST_CONFIG
"""
3 changes: 3 additions & 0 deletions src/load/azext_load/data_plane/load_test/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def load_arguments(self, _):
with self.argument_context("load test create") as c:
c.argument("test_id", argtypes.test_id_no_completer)
c.argument("test_plan", argtypes.test_plan)
c.argument("test_type", argtypes.test_type)
c.argument("display_name", argtypes.test_display_name)
c.argument("test_description", argtypes.test_description)
c.argument("env", argtypes.env, help="space-separated environment variables: key[=value] [key[=value] ...].")
Expand All @@ -32,6 +33,7 @@ def load_arguments(self, _):
c.argument("autostop", argtypes.autostop)
c.argument("autostop_error_rate", argtypes.autostop_error_rate)
c.argument("autostop_error_rate_time_window", argtypes.autostop_error_rate_time_window)
c.argument("regionwise_engines", argtypes.regionwise_engines)

with self.argument_context("load test update") as c:
c.argument("load_test_config_file", argtypes.load_test_config_file)
Expand All @@ -52,6 +54,7 @@ def load_arguments(self, _):
c.argument("autostop", argtypes.autostop)
c.argument("autostop_error_rate", argtypes.autostop_error_rate)
c.argument("autostop_error_rate_time_window", argtypes.autostop_error_rate_time_window)
c.argument("regionwise_engines", argtypes.regionwise_engines)

with self.argument_context("load test download-files") as c:
c.argument("path", argtypes.dir_path)
Expand Down
1 change: 1 addition & 0 deletions src/load/azext_load/data_plane/load_test_run/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def load_test_run_commands(self, _):
validator=validators.validate_download,
)
g.custom_command("stop", "stop_test_run", confirmation=True)
g.custom_command("get-artifacts-url", "copy_test_run_artifacts_url")

with self.command_group(
"load test-run app-component",
Expand Down
Loading
Loading