Skip to content

Commit 48cb14f

Browse files
[azure-developer-loadtesting] Updated SDK for API Version 2024-05-01-preview (#38985)
* Updated the SDK with the new generation flow and to newer API version 2024-05-01-preview.
1 parent 957696b commit 48cb14f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+16253
-16801
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
/sdk/keyvault/ @mccoyp
179179

180180
# PRLabel: %Load Test Service
181-
/sdk/loadtesting/azure-developer-loadtesting/ @msyyc @iscai-msft
181+
/sdk/loadtesting/azure-developer-loadtesting/ @prativen @mitsha-microsoft @ninallam
182182

183183
# PRLabel: %Monitor
184184
/sdk/loganalytics/azure-loganalytics/ @azmonapplicationinsights @pvaneck

sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Release History
22

3+
## 1.1.0b1 (2025-03-27)
4+
5+
Updated the client library to use API Version 2025-05-01-preview. This adds all the capabilities that were introduced until this API version.
6+
7+
This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported.
8+
9+
### Features Added
10+
11+
- This release adds models and enums for all the APIs supported by Azure Load Testing
12+
- Support for AutoStop Criteria
13+
- Use `auto_stop_criteria` property on the `Test` model to add autostop criteria
14+
- Support for Quick Load Tests with RPS (Requests Per Second) Inputs
15+
- Use `requests_per_second` and `max_response_time_in_ms` in `OptionalLoadTestConfig` model to specify desired RPS for a quick load test
16+
- Support for URL Tests with JSON based test plans
17+
- Added enum `TestKind` with value `URL` and support for `URL_TEST_CONFIG` file type in the `FileType` enum
18+
- Support for Locust Load Tests
19+
- Added value `Locust` in the `TestKind` enum
20+
- Support for Multi Region Load Tests
21+
- Added property `regional_load_test_config` in `LoadTestConfiguration` model to specify regional load distribution
22+
- Support for Disabling Public IP Deployment for Private Load Tests
23+
- Added property `public_ip_disabled` to the `Test` model to disable injecting public IP
24+
- Support for uploading ZIP Artifacts
25+
- Added value `ZIPPED_ARTIFACTS` in the `FileType` enum
26+
- Support for all Test Profiles & Test Profile Run Scenarios
27+
- Added methods `create_or_update_test_profile`, `get_test_profile`, `delete_test_profile` and `list_test_profiles` in `LoadTestAdministrationClient` to work with Test Profiles
28+
- Added methods `begin_test_profile_run`, `get_test_profile_run`, `delete_test_profile_run` and `list_test_profile_runs` in `LoadTestRunClient` to work with Test Profile Runs
29+
330
## 1.0.1 (2025-01-20)
431

532
### Bugs Fixed

sdk/loadtesting/azure-developer-loadtesting/README.md

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
# Azure Load Testing client library for Python
2+
23
Azure Load Testing provides client library in python to the user by which they can interact natively with Azure Load Testing service. Azure Load Testing is a fully managed load-testing service that enables you to generate high-scale load. The service simulates traffic for your applications, regardless of where they're hosted. Developers, testers, and quality assurance (QA) engineers can use it to optimize application performance, scalability, or capacity.
34

45
## Documentation
6+
57
Various documentation is available to help you get started
68

7-
<!-- - [Source code][source_code] -->
89
- [API reference documentation][api_reference_doc]
910
- [Product Documentation][product_documentation]
1011

1112
## Getting started
1213

14+
### Prequisites
15+
16+
- Python 3.8 or later is required to use this package.
17+
- You need an [Azure subscription][azure_sub] to use this package.
18+
- An existing Azure LoadTesting resource.
19+
1320
### Installing the package
1421

1522
```bash
1623
python -m pip install azure-developer-loadtesting
1724
```
1825

19-
#### Prequisites
20-
21-
- Python 3.7 or later is required to use this package.
22-
- You need an [Azure subscription][azure_sub] to use this package.
23-
- An existing Azure Developer LoadTesting instance.
24-
25-
#### Create with an Azure Active Directory Credential
26+
### Create with an Azure Active Directory Credential
2627

2728
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
2829
provide an instance of the desired credential type obtained from the
@@ -36,9 +37,9 @@ As an example, sign in via the Azure CLI `az login` command and [DefaultAzureCre
3637

3738
Use the returned token credential to authenticate the client.
3839

39-
#### Create the client
40+
### Create the client
4041

41-
Azure Developer LoadTesting SDK has 2 sub-clients of the main client (`LoadTestingClient`) to interact with the service, 'administration' and 'test_run'.
42+
Azure Developer LoadTesting SDK has 2 sub-clients of the main client (`LoadTestingClient`) to interact with the service, 'LoadTestAdministrationClient' for administrative operations and 'LoadTestRunClient' to run tests/test-profiles.
4243

4344
```python
4445
from azure.developer.loadtesting import LoadTestAdministrationClient
@@ -53,6 +54,8 @@ client = LoadTestAdministrationClient(endpoint='<endpoint>', credential=DefaultA
5354

5455
`<endpoint>` refers to the data-plane endpoint/URL of the resource.
5556

57+
The data-plane endpoint is obtained from Control Plane APIs. To obtain the data-plane endpoint for your resource, follow [this documentation][obtaining_data_plane_uri].
58+
5659
## Key concepts
5760

5861
The Azure Load Test client library for python allows you to interact with each of these components through the use of clients. There are two top-level clients which are the main entry points for the library
@@ -66,7 +69,7 @@ These two clients also have there asynchronous counterparts, which are
6669

6770
### Load Test Administration Client
6871

69-
The `LoadTestAdministrationClient` is used to administer and configure the load tests, app components and metrics.
72+
The `LoadTestAdministrationClient` is used to administer and configure the load tests, test profiles, app components and metrics.
7073

7174
#### Test
7275

@@ -86,7 +89,7 @@ During a load test, Azure Load Testing collects metrics about the test execution
8689

8790
### Test Run Client
8891

89-
The `LoadTestRunClient` is used to start and stop test runs corresponding to a load test. A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test.
92+
The `LoadTestRunClient` is used to start and stop test runs corresponding to a load test. It can also be used to start and stop test profile runs corresponding to a test profile. A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter or Locust script, the load test YAML configuration, the list of app components to monitor, and the results of the test.
9093

9194
### Data-Plane Endpoint
9295

@@ -96,15 +99,16 @@ Data-plane of Azure Load Testing resources is addressable using the following UR
9699

97100
The first GUID `00000000-0000-0000-0000-000000000000` is the unique identifier used for accessing the Azure Load Testing resource. This is followed by `aaa` which is the Azure region of the resource.
98101

99-
The data-plane endpoint is obtained from Control Plane APIs.
102+
The data-plane endpoint is obtained from Control Plane APIs. To obtain the data-plane endpoint for your resource, follow [this documentation][obtaining_data_plane_uri].
100103

101-
**Example:** `1234abcd-12ab-12ab-12ab-123456abcdef.eus.cnt-prod.loadtesting.azure.com`
104+
**Example:** `1234abcd-12ab-12ab-12ab-123456abcdef.eastus.cnt-prod.loadtesting.azure.com`
102105

103-
In the above example, `eus` represents the Azure region `East US`.
106+
In the above example, `eastus` represents the Azure region `East US`.
104107

105108
## Examples
106109

107110
### Creating a load test
111+
108112
```python
109113
from azure.developer.loadtesting import LoadTestAdministrationClient
110114
from azure.identity import DefaultAzureCredential
@@ -125,7 +129,7 @@ try:
125129
{
126130
"description": "",
127131
"displayName": "My New Load Test",
128-
"loadTestConfig": {
132+
"loadTestConfiguration": {
129133
"engineInstances": 1,
130134
"splitAllCSVs": False,
131135
},
@@ -169,12 +173,14 @@ except HttpResponseError as e:
169173

170174
```
171175

172-
### Uploading .jmx file to a Test
176+
### Uploading test script file to a Test
177+
173178
```python
174179
from azure.developer.loadtesting import LoadTestAdministrationClient
175180
from azure.identity import DefaultAzureCredential
176181
from azure.core.exceptions import HttpResponseError
177182

183+
# This sample uploads a JMX Test Script File
178184
TEST_ID = "some-test-id"
179185
FILE_NAME = "some-file-name.jmx"
180186

@@ -194,6 +200,7 @@ except HttpResponseError as e:
194200
```
195201

196202
### Running a Test
203+
197204
```python
198205
from azure.developer.loadtesting import LoadTestRunClient
199206
from azure.identity import DefaultAzureCredential
@@ -222,6 +229,41 @@ except HttpResponseError as e:
222229
print("Failed with error: {}".format(e.response.json()))
223230
```
224231

232+
## Troubleshooting
233+
234+
### Logging
235+
236+
This SDK uses Python standard [logging][python_logging] library for logging.
237+
Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
238+
level.
239+
240+
Detailed DEBUG level logging, including request/response bodies and unredacted
241+
headers, can be enabled on a client with the `logging_enable` keyword argument.
242+
Do note that DEBUG level logging can contain sensitive information:
243+
244+
```python
245+
import sys
246+
import logging
247+
from azure.identity import DefaultAzureCredential
248+
249+
# Create a logger for the 'azure' SDK
250+
logger = logging.getLogger('azure')
251+
logger.setLogLevel(logging.DEBUG)
252+
253+
# Configure console output
254+
handler = logging.StreamHandler(stream=sys.stdout)
255+
logger.addHandler(handler)
256+
257+
# Enable logging for a client
258+
client = LoadTestAdministrationClient(endpoint='<endpoint>', credential=DefaultAzureCredential(), logging_enable=True)
259+
```
260+
261+
Similarly, `logging_enable` can enable detailed logging for a single call, even when it isn't enabled for the whole client
262+
263+
```python
264+
client.create_or_update_test(..., logging_enable=True)
265+
```
266+
225267
## Next steps
226268

227269
More samples can be found [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/loadtesting/azure-developer-loadtesting/samples).
@@ -243,9 +285,6 @@ This project has adopted the
243285
see the Code of Conduct FAQ or contact [email protected] with any
244286
additional questions or comments.
245287

246-
## Troubleshooting
247-
More about it is coming soon...
248-
249288
<!-- LINKS -->
250289
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
251290
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
@@ -255,4 +294,6 @@ More about it is coming soon...
255294
[pip]: https://pypi.org/project/pip/
256295
[azure_sub]: https://azure.microsoft.com/free/
257296
[api_reference_doc]: https://docs.microsoft.com/rest/api/loadtesting/
258-
[product_documentation]: https://azure.microsoft.com/services/load-testing/
297+
[product_documentation]: https://azure.microsoft.com/services/load-testing/
298+
[obtaining_data_plane_uri]: https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri
299+
[python_logging]: https://docs.python.org/3/library/logging.html

sdk/loadtesting/azure-developer-loadtesting/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/loadtesting/azure-developer-loadtesting",
5-
"Tag": "python/loadtesting/azure-developer-loadtesting_1075f6ca83"
5+
"Tag": "python/loadtesting/azure-developer-loadtesting_a105162cd8"
66
}
Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
1-
# -------------------------------------------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
23
# Copyright (c) Microsoft Corporation. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for
4-
# license information.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
57
# --------------------------------------------------------------------------
6-
from ._client import LoadTestAdministrationClient, LoadTestRunClient
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import LoadTestAdministrationClient # type: ignore
16+
from ._client import LoadTestRunClient # type: ignore
717
from ._version import VERSION
818

919
__version__ = VERSION
10-
__all__ = ["LoadTestAdministrationClient", "LoadTestRunClient"]
20+
21+
try:
22+
from ._patch import __all__ as _patch_all
23+
from ._patch import *
24+
except ImportError:
25+
_patch_all = []
26+
from ._patch import patch_sdk as _patch_sdk
27+
28+
__all__ = [
29+
"LoadTestAdministrationClient",
30+
"LoadTestRunClient",
31+
]
32+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
33+
34+
_patch_sdk()

0 commit comments

Comments
 (0)