Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[load] Updated vendored sdk to use 2024-12-01-preview API version data plane commands #8479

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
8 changes: 4 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,10 @@ 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."
f"ZIP artifact {zip_artifact} is not valid. Please check the file and try again. Current file status is {file_response.get("validationStatus")}"
)


Expand Down Expand Up @@ -797,8 +798,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,520 changes: 696 additions & 824 deletions src/load/azext_load/tests/latest/recordings/test_load_app_component.yaml

Large diffs are not rendered by default.

4,532 changes: 1,788 additions & 2,744 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,569 changes: 1,810 additions & 2,759 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,904 changes: 632 additions & 1,272 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.

776 changes: 280 additions & 496 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,714 changes: 807 additions & 907 deletions src/load/azext_load/tests/latest/recordings/test_load_test_file.yaml

Large diffs are not rendered by default.

2,620 changes: 1,021 additions & 1,599 deletions src/load/azext_load/tests/latest/recordings/test_load_test_kvrefid.yaml

Large diffs are not rendered by default.

732 changes: 258 additions & 474 deletions src/load/azext_load/tests/latest/recordings/test_load_test_list.yaml

Large diffs are not rendered by default.

2,863 changes: 1,260 additions & 1,603 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,330 changes: 600 additions & 730 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_create.yaml

Large diffs are not rendered by default.

1,825 changes: 826 additions & 999 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_debug_mode.yaml

Large diffs are not rendered by default.

1,401 changes: 572 additions & 829 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_delete.yaml

Large diffs are not rendered by default.

41,760 changes: 20,825 additions & 20,935 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,344 changes: 584 additions & 760 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_list.yaml

Large diffs are not rendered by default.

2,031 changes: 929 additions & 1,102 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,377 changes: 581 additions & 796 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_show.yaml

Large diffs are not rendered by default.

857 changes: 342 additions & 515 deletions src/load/azext_load/tests/latest/recordings/test_load_test_run_stop.yaml

Large diffs are not rendered by default.

1,685 changes: 885 additions & 800 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.

713 changes: 270 additions & 443 deletions src/load/azext_load/tests/latest/recordings/test_load_test_show.yaml

Large diffs are not rendered by default.

2,111 changes: 917 additions & 1,194 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
Loading