Skip to content

Commit

Permalink
[load] Updated vendored sdk to use 2024-12-01-preview API version dat…
Browse files Browse the repository at this point in the history
…a plane commands (#8479)

* updated sdk with 2024-12-01 version api

* Updating client stop call and response from list_metric_dimension_values

* Fixi for few regression issue

* Updated test recordings to use new API version for data plane

* Changes for azdev style

* initial params setup

* Added validators and support for config input

* Added test cases for engine mi feature

* Revert "Added test cases for engine mi feature"

This reverts commit e14f50f.

* Revert "Added validators and support for config input"

This reverts commit 4fc28d0.

* Revert "initial params setup"

This reverts commit 211af5d.

* Changes after azdev mask

* Updated recordings after syncing cli and cli-extension repo

* Minor fix for compatiblity with python 3.9, 3.10 and 3.11
  • Loading branch information
Himanshu49 authored Feb 25, 2025
1 parent 00c0e3a commit 7ec6f61
Show file tree
Hide file tree
Showing 55 changed files with 49,723 additions and 68,029 deletions.
5 changes: 5 additions & 0 deletions src/load/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Release History
===============
1.4.3
++++++
* Updated the vendored_sdks to include 2024-12-01-preview data plane API version.


1.4.2
++++++
* Update minimum required version of azure-cli-core to 2.66.0. This is needed to use `from azure.cli.core.util import run_az_cmd`, which is used in download-files command for high-scale load tests.
Expand Down
4 changes: 2 additions & 2 deletions src/load/azext_load/data_plane/load_test_run/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def list_test_runs(cmd, test_id, load_test_resource, resource_group_name=None):
def stop_test_run(cmd, load_test_resource, test_run_id, resource_group_name=None):
client = get_testrun_data_plane_client(cmd, load_test_resource, resource_group_name)
logger.info("Stopping test run %s", test_run_id)
response = client.stop(test_run_id=test_run_id)
response = client.stop_test_run(test_run_id=test_run_id)
logger.debug("Test run stopped with following response %s", response)
logger.info("Stop test run completed")
return response
Expand Down Expand Up @@ -523,7 +523,7 @@ def list_test_run_metrics(
interval=interval,
time_interval=time_interval,
)
dimension_filter["values"] = metric_dimensions.value
dimension_filter["values"] = list(metric_dimensions)

metrics = client.list_metrics(
test_run_id,
Expand Down
10 changes: 6 additions & 4 deletions src/load/azext_load/data_plane/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,12 @@ def upload_zipped_artifacts_helper(
file_to_upload=zip_artifact, file_type=AllowedFileTypes.ZIPPED_ARTIFACTS,
wait=wait
)
if wait and file_response.get("validationStatus") != "VALIDATION_SUCCESS":
if wait and file_response.get("validationStatus") not in ("VALIDATION_SUCCESS", "NOT_VALIDATED"):
# pylint: disable=line-too-long
raise FileOperationError(
f"ZIP artifact {zip_artifact} is not valid. Please check the file and try again."
"ZIP artifact {} is not valid. Please check the file and try again. Current file status is {}".format(
zip_artifact, file_response.get("validationStatus")
)
)


Expand Down Expand Up @@ -797,8 +800,7 @@ def upload_test_plan_helper(
def upload_files_helper(
client, test_id, yaml_data, test_plan, load_test_config_file, wait, test_type
):
files = client.list_test_files(test_id)

files = list(client.list_test_files(test_id))
upload_properties_file_helper(
client=client,
test_id=test_id, yaml_data=yaml_data,
Expand Down
1,511 changes: 605 additions & 906 deletions src/load/azext_load/tests/latest/recordings/test_load_app_component.yaml

Large diffs are not rendered by default.

4,522 changes: 1,740 additions & 2,782 deletions src/load/azext_load/tests/latest/recordings/test_load_test_advancedurl.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4,473 changes: 1,934 additions & 2,539 deletions src/load/azext_load/tests/latest/recordings/test_load_test_autostop.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,883 changes: 643 additions & 1,240 deletions src/load/azext_load/tests/latest/recordings/test_load_test_create.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

774 changes: 279 additions & 495 deletions src/load/azext_load/tests/latest/recordings/test_load_test_delete.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,684 changes: 835 additions & 849 deletions src/load/azext_load/tests/latest/recordings/test_load_test_file.yaml

Large diffs are not rendered by default.

2,618 changes: 1,020 additions & 1,598 deletions src/load/azext_load/tests/latest/recordings/test_load_test_kvrefid.yaml

Large diffs are not rendered by default.

702 changes: 286 additions & 416 deletions src/load/azext_load/tests/latest/recordings/test_load_test_list.yaml

Large diffs are not rendered by default.

2,918 changes: 1,243 additions & 1,675 deletions src/load/azext_load/tests/latest/recordings/test_load_test_mark_compare_baseline.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,334 changes: 645 additions & 689 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_create.yaml

Large diffs are not rendered by default.

1,773 changes: 843 additions & 930 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_debug_mode.yaml

Large diffs are not rendered by default.

1,349 changes: 588 additions & 761 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_delete.yaml

Large diffs are not rendered by default.

41,723 changes: 20,828 additions & 20,895 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_download_files.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,371 changes: 578 additions & 793 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_list.yaml

Large diffs are not rendered by default.

2,018 changes: 944 additions & 1,074 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_metrics.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,393 changes: 654 additions & 739 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_show.yaml

Large diffs are not rendered by default.

898 changes: 384 additions & 514 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_stop.yaml

Large diffs are not rendered by default.

1,601 changes: 779 additions & 822 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_update.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

711 changes: 269 additions & 442 deletions src/load/azext_load/tests/latest/recordings/test_load_test_show.yaml

Large diffs are not rendered by default.

2,102 changes: 934 additions & 1,168 deletions src/load/azext_load/tests/latest/recordings/test_load_test_splitcsv.yaml

Large diffs are not rendered by default.

876 changes: 330 additions & 546 deletions src/load/azext_load/tests/latest/recordings/test_load_test_update.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion src/load/azext_load/tests/latest/test_load_advanced_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ def test_load_test_advancedurl(self):
checks=checks,
)

# Delete file, since we can't have multiple files with same name irrespective of file type
self.kwargs.update(
{
"file_name": LoadTestConstants.ADVANCED_TEST_URL_CONFIG_FILE_NAME,
}
)
self.cmd(
"az load test file delete "
"--test-id {test_id} "
"--load-test-resource {load_test_resource} "
"--resource-group {resource_group} "
"--file-name {file_name} "
"--yes"
)

# Update the load test with advanced URL requests json using file upload
# file type URL_TEST_CONFIG specified
# assert test script is generated
Expand Down Expand Up @@ -259,7 +274,8 @@ def test_load_test_advancedurl(self):
assert test_script_uri != urllib.parse.urlparse(response["inputArtifacts"]["testScriptFileInfo"]["url"]).path

# Invalid: Try upload advanced URL requests json config file as a TEST_SCRIPT
_configure_command_assert_exception(self, "File upload failed due to validation failure: Test script is invalid", is_file_upload=True, file_path=LoadTestConstants.ADVANCED_TEST_URL_CONFIG_FILE_PATH, file_type="TEST_SCRIPT")
# Uncomment when BUG : https://devdiv.visualstudio.com/OnlineServices/_workitems/edit/2393957 is fixed.
#_configure_command_assert_exception(self, "Invalid FileType", is_file_upload=True, file_path=LoadTestConstants.ADVANCED_TEST_URL_CONFIG_FILE_PATH, file_type="TEST_SCRIPT")

self.cmd(
"az load test delete "
Expand Down
41 changes: 41 additions & 0 deletions src/load/azext_load/tests/latest/test_load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,47 @@ def test_load_test_file(self):
except Exception as e:
assert "Zip file containing sub-directories in the zip entry are not supported" in str(e)

# INVALID case of file with same name and different types should throw error

# Uploading json file without file type. Default type would be ADDITIONAL_ARTIFACTS
self.kwargs.update(
{
"file_path": LoadTestConstants.ADVANCED_TEST_URL_CONFIG_FILE_PATH,
}
)
checks = [
JMESPathCheck("fileType", "ADDITIONAL_ARTIFACTS"),
JMESPathCheck("fileName", LoadTestConstants.ADVANCED_TEST_URL_CONFIG_FILE_NAME),
]
self.cmd(
"az load test file upload "
"--test-id {test_id} "
"--load-test-resource {load_test_resource} "
"--resource-group {resource_group} "
'--path "{file_path}" ',
checks=checks,
)

# Trying to upload same file with different file type
# Expected to throw INVALIDFILENAMEEXCEPTION
self.kwargs.update(
{
"file_type": LoadTestConstants.ADVANCED_URL_FILE_TYPE,
}
)

try:
self.cmd(
"az load test file upload "
"--test-id {test_id} "
"--load-test-resource {load_test_resource} "
"--resource-group {resource_group} "
"--file-type {file_type} "
'--path "{file_path}" '
)
except Exception as e:
assert "InvalidFileName" in str(e)

# INVALID case of ZIP artifact size > 50MB
# This is commented because it requires a resource of size > 50 MB
# storing which in GitHub is not recommended
Expand Down
14 changes: 10 additions & 4 deletions src/load/azext_load/vendored_sdks/loadtesting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._client import LoadTestAdministrationClient
from ._client import LoadTestRunClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import LoadTestAdministrationClient # type: ignore
from ._client import LoadTestRunClient # type: ignore
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
Expand All @@ -23,6 +29,6 @@
"LoadTestAdministrationClient",
"LoadTestRunClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
22 changes: 9 additions & 13 deletions src/load/azext_load/vendored_sdks/loadtesting/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.pipeline import policies
Expand All @@ -18,22 +19,18 @@
from ._serialization import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class LoadTestAdministrationClient(
LoadTestAdministrationClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
class LoadTestAdministrationClient(LoadTestAdministrationClientOperationsMixin):
"""LoadTestAdministrationClient.
:param endpoint: These APIs allow end users to create, view and run load tests using Azure Load
Test Service. Required.
:param endpoint: Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
"2024-12-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""
Expand Down Expand Up @@ -93,24 +90,23 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "LoadTestAdministrationClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)


class LoadTestRunClient(LoadTestRunClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
class LoadTestRunClient(LoadTestRunClientOperationsMixin):
"""LoadTestRunClient.
:param endpoint: These APIs allow end users to create, view and run load tests using Azure Load
Test Service. Required.
:param endpoint: Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
"2024-12-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""
Expand Down Expand Up @@ -170,7 +166,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "LoadTestRunClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
17 changes: 7 additions & 10 deletions src/load/azext_load/vendored_sdks/loadtesting/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


Expand All @@ -23,19 +22,18 @@ class LoadTestAdministrationClientConfiguration: # pylint: disable=too-many-ins
Note that all parameters used to create this instance are saved as instance
attributes.
:param endpoint: These APIs allow end users to create, view and run load tests using Azure Load
Test Service. Required.
:param endpoint: Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
"2024-12-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
api_version: str = kwargs.pop("api_version", "2024-12-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down Expand Up @@ -66,25 +64,24 @@ def _configure(self, **kwargs: Any) -> None:
)


class LoadTestRunClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class LoadTestRunClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for LoadTestRunClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param endpoint: These APIs allow end users to create, view and run load tests using Azure Load
Test Service. Required.
:param endpoint: Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
"2024-12-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
api_version: str = kwargs.pop("api_version", "2024-12-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Loading

0 comments on commit 7ec6f61

Please sign in to comment.