Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit e00db27

Browse files
Revert "[load] CLI changes for the CICD improvements. (Azure#8546)"
This reverts commit b461181.
1 parent 241eeac commit e00db27

79 files changed

Lines changed: 77331 additions & 81641 deletions

File tree

Some content is hidden

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

src/load/HISTORY.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
Release History
44
===============
55

6-
1.7.0
7-
++++++
8-
* Add support for metrics reference identity. Metrics reference identity can be set using `--metrics-reference-identity` argument in 'az load test create' and 'az load test update' commands. Metrics reference identity set in YAML config file under key `referenceIdentities` with `kind` as `Metrics` will also be honoured.
9-
106

117
1.6.0
128
++++++

src/load/azext_load/data_plane/load_test/custom.py

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
load_yaml,
2222
upload_file_to_test,
2323
upload_files_helper,
24-
merge_existing_app_components,
25-
merge_existing_server_metrics,
26-
parse_app_comps_and_server_metrics,
27-
is_not_empty_dictionary,
2824
)
2925
from azext_load.data_plane.utils.models import (
3026
AllowedTestTypes,
@@ -52,7 +48,6 @@ def create_test(
5248
secrets=None,
5349
certificate=None,
5450
key_vault_reference_identity=None,
55-
metrics_reference_identity=None,
5651
subnet_id=None,
5752
split_csv=None,
5853
disable_public_ip=None,
@@ -71,14 +66,12 @@ def create_test(
7166
body = client.get_test(test_id)
7267
except ResourceNotFoundError:
7368
pass
74-
7569
if body is not None:
7670
msg = f"Test with given test ID : {test_id} already exist."
7771
logger.debug(msg)
7872
raise InvalidArgumentValueError(msg)
7973
body = {}
8074
yaml, yaml_test_body = None, None
81-
app_components, add_defaults_to_app_components, server_metrics = None, None, None
8275
autostop_criteria = create_autostop_criteria_from_args(
8376
autostop=autostop, error_rate=autostop_error_rate, time_window=autostop_error_rate_time_window)
8477
if load_test_config_file is None:
@@ -95,7 +88,6 @@ def create_test(
9588
secrets=secrets,
9689
certificate=certificate,
9790
key_vault_reference_identity=key_vault_reference_identity,
98-
metrics_reference_identity=metrics_reference_identity,
9991
subnet_id=subnet_id,
10092
split_csv=split_csv,
10193
disable_public_ip=disable_public_ip,
@@ -107,7 +99,6 @@ def create_test(
10799
else:
108100
yaml = load_yaml(load_test_config_file)
109101
yaml_test_body = convert_yaml_to_test(cmd, yaml)
110-
app_components, add_defaults_to_app_components, server_metrics = parse_app_comps_and_server_metrics(data=yaml)
111102
test_type = (
112103
test_type or
113104
yaml.get(LoadTestConfigKeys.TEST_TYPE) or
@@ -127,7 +118,6 @@ def create_test(
127118
secrets=secrets,
128119
certificate=certificate,
129120
key_vault_reference_identity=key_vault_reference_identity,
130-
metrics_reference_identity=metrics_reference_identity,
131121
subnet_id=subnet_id,
132122
split_csv=split_csv,
133123
disable_public_ip=disable_public_ip,
@@ -146,32 +136,8 @@ def create_test(
146136
upload_files_helper(
147137
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait, evaluated_test_type
148138
)
149-
logger.info("Upload files to test %s has completed", test_id)
150-
if is_not_empty_dictionary(app_components):
151-
# only get and patch the app components if its present in the yaml.
152-
app_component_response = client.create_or_update_app_components(
153-
test_id=test_id, body={"testId": test_id, "components": app_components}
154-
)
155-
logger.warning(
156-
"Added app components for test ID: %s and response is %s", test_id, app_component_response
157-
)
158-
if is_not_empty_dictionary(server_metrics):
159-
# only get and patch the app components if its present in the yaml.
160-
server_metrics_existing = None
161-
try:
162-
server_metrics_existing = client.get_server_metrics_config(test_id)
163-
except ResourceNotFoundError:
164-
server_metrics_existing = {"metrics": {}}
165-
server_metrics_merged = merge_existing_server_metrics(
166-
add_defaults_to_app_components, server_metrics, server_metrics_existing.get("metrics", {})
167-
)
168-
server_metric_response = client.create_or_update_server_metrics_config(
169-
test_id=test_id, body={"testId": test_id, "metrics": server_metrics_merged}
170-
)
171-
logger.warning(
172-
"Added server metrics for test ID: %s and response is %s", test_id, server_metric_response
173-
)
174139
response = client.get_test(test_id)
140+
logger.info("Upload files to test %s has completed", test_id)
175141
logger.info("Test %s has been created successfully", test_id)
176142
return response.as_dict()
177143

@@ -190,7 +156,6 @@ def update_test(
190156
secrets=None,
191157
certificate=None,
192158
key_vault_reference_identity=None,
193-
metrics_reference_identity=None,
194159
subnet_id=None,
195160
split_csv=None,
196161
disable_public_ip=None,
@@ -213,13 +178,11 @@ def update_test(
213178
logger.debug("Retrieved test with test ID: %s and body : %s", test_id, body)
214179

215180
yaml, yaml_test_body = None, None
216-
app_components, server_metrics, add_defaults_to_app_components = None, None, None
217181
autostop_criteria = create_autostop_criteria_from_args(
218182
autostop=autostop, error_rate=autostop_error_rate, time_window=autostop_error_rate_time_window)
219183
if load_test_config_file is not None:
220184
yaml = load_yaml(load_test_config_file)
221185
yaml_test_body = convert_yaml_to_test(cmd, yaml)
222-
app_components, add_defaults_to_app_components, server_metrics = parse_app_comps_and_server_metrics(data=yaml)
223186
body = create_or_update_test_with_config(
224187
test_id,
225188
body,
@@ -231,7 +194,6 @@ def update_test(
231194
secrets=secrets,
232195
certificate=certificate,
233196
key_vault_reference_identity=key_vault_reference_identity,
234-
metrics_reference_identity=metrics_reference_identity,
235197
subnet_id=subnet_id,
236198
split_csv=split_csv,
237199
disable_public_ip=disable_public_ip,
@@ -251,7 +213,6 @@ def update_test(
251213
secrets=secrets,
252214
certificate=certificate,
253215
key_vault_reference_identity=key_vault_reference_identity,
254-
metrics_reference_identity=metrics_reference_identity,
255216
subnet_id=subnet_id,
256217
split_csv=split_csv,
257218
disable_public_ip=disable_public_ip,
@@ -269,37 +230,6 @@ def update_test(
269230
upload_files_helper(
270231
client, test_id, yaml, test_plan, load_test_config_file, not custom_no_wait, body.get("kind")
271232
)
272-
273-
if is_not_empty_dictionary(app_components):
274-
# only get and patch the app components if its present in the yaml.
275-
try:
276-
app_components_existing = client.get_app_components(test_id)
277-
except ResourceNotFoundError:
278-
app_components_existing = {"components": {}}
279-
app_components_merged = merge_existing_app_components(
280-
app_components, app_components_existing.get("components", {})
281-
)
282-
app_component_response = client.create_or_update_app_components(
283-
test_id=test_id, body={"testId": test_id, "components": app_components_merged}
284-
)
285-
logger.warning(
286-
"Added app components for test ID: %s and response is %s", test_id, app_component_response
287-
)
288-
if is_not_empty_dictionary(server_metrics):
289-
# only get and patch the app components if its present in the yaml.
290-
try:
291-
server_metrics_existing = client.get_server_metrics_config(test_id)
292-
except ResourceNotFoundError:
293-
server_metrics_existing = {"metrics": {}}
294-
server_metrics_merged = merge_existing_server_metrics(
295-
add_defaults_to_app_components, server_metrics_existing.get("metrics", {}), server_metrics
296-
)
297-
server_metric_response = client.create_or_update_server_metrics_config(
298-
test_id=test_id, body={"testId": test_id, "metrics": server_metrics_merged}
299-
)
300-
logger.warning(
301-
"Added server metrics for test ID: %s and response is %s", test_id, server_metric_response
302-
)
303233
response = client.get_test(test_id)
304234
logger.info("Upload files to test %s has completed", test_id)
305235
logger.info("Test %s has been updated successfully", test_id)

src/load/azext_load/data_plane/load_test/help.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@
4949
- name: Create a test with user assigned Managed Identity reference for engine.
5050
text: |
5151
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --engine-ref-id-type UserAssigned --engine-ref-ids "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/sample-mi"
52-
- name: Create a test with user assigned Managed Identity reference for accessing the metrics of the configured apps.
53-
text: |
54-
az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --engine-ref-id-type UserAssigned --metrics-reference-id "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/sample-mi"
5552
"""
5653

5754
helps[

src/load/azext_load/data_plane/load_test/params.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def load_arguments(self, _):
2727
c.argument(
2828
"key_vault_reference_identity", argtypes.key_vault_reference_identity
2929
)
30-
c.argument(
31-
"metrics_reference_identity", argtypes.metrics_reference_identity, help="The identity that will be used to access the metrics. This will be defaulted to SystemAssigned if not given."
32-
)
3330
c.argument("engine_instances", argtypes.engine_instances)
3431
c.argument("custom_no_wait", argtypes.custom_no_wait)
3532
c.argument("disable_public_ip", argtypes.disable_public_ip)
@@ -51,9 +48,6 @@ def load_arguments(self, _):
5148
c.argument(
5249
"key_vault_reference_identity", argtypes.key_vault_reference_identity, help="The identity that will be used to access the key vault. Provide `null` or `None` to use the system assigned identity of the load test resource."
5350
)
54-
c.argument(
55-
"metrics_reference_identity", argtypes.metrics_reference_identity, help="The identity that will be used to access the metrics. Provide `null` or `None` to use the system assigned identity of the load test resource."
56-
)
5751
c.argument("engine_instances", argtypes.engine_instances)
5852
c.argument("subnet_id", argtypes.subnet_id)
5953
c.argument("split_csv", argtypes.split_csv)

src/load/azext_load/data_plane/utils/argtypes.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,11 @@
129129
)
130130

131131
key_vault_reference_identity = CLIArgumentType(
132-
validator=validators.validate_keyvault_identity_ref_id,
133132
options_list=["--keyvault-reference-id"],
134133
type=str,
135134
help="The identity that will be used to access the key vault.",
136135
)
137136

138-
metrics_reference_identity = CLIArgumentType(
139-
validator=validators.validate_metrics_identity_ref_id,
140-
options_list=["--metrics-reference-id"],
141-
type=str,
142-
help="The identity that will be used to get the metrics of the configured apps from server pass-fail criteria.",
143-
)
144-
145137
split_csv = CLIArgumentType(
146138
validator=validators.validate_split_csv,
147139
options_list=["--split-csv"],

src/load/azext_load/data_plane/utils/constants.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# --------------------------------------------------------------------------------------------
55

66
from dataclasses import dataclass
7-
from typing import ClassVar
87
from .models import AllowedTrendsResponseTimeAggregations
98

109

@@ -25,25 +24,12 @@ class LoadTestConfigKeys:
2524
AUTOSTOP_ERROR_RATE = "errorPercentage"
2625
AUTOSTOP_ERROR_RATE_TIME_WINDOW = "timeWindow"
2726
FAILURE_CRITERIA = "failureCriteria"
28-
CLIENT_METRICS_PF = "clientMetrics"
29-
SERVER_METRICS_PF = "serverMetrics"
30-
METRIC_NAME = "metricName"
31-
METRIC_NAME_SERVER_METRICS = "name"
32-
METRIC_NAMESPACE_SERVER_METRICS = "namespace"
33-
METRIC_NAMESPACE = "metricNamespace"
34-
RESOURCEID = "resourceId"
35-
AGGREGATION = "aggregation"
36-
CONDITION = "condition"
37-
APP_COMPONENTS = "appComponents"
38-
SERVER_METRICS_APP_COMPONENTS = "metrics"
3927
REGIONAL_LOADTEST_CONFIG = "regionalLoadTestConfig"
4028
REGION = "region"
4129
QUICK_START = "quickStartTest"
4230
SPLIT_CSV = "splitAllCSVs"
4331
REFERENCE_IDENTITIES = "referenceIdentities"
4432
ENGINE = "Engine"
45-
METRICS = "Metrics"
46-
KEY_VAULT = "KeyVault"
4733
TYPE = "type"
4834
KIND = "kind"
4935
VALUE = "value"
@@ -90,11 +76,3 @@ class LoadTestTrendsKeys:
9076
AllowedTrendsResponseTimeAggregations.P999.value: "pct999ResTime",
9177
AllowedTrendsResponseTimeAggregations.P9999.value: "pct9999ResTime",
9278
}
93-
94-
95-
@dataclass
96-
class LoadTestFailureCriteriaKeys:
97-
CONDITION_ENUM_MAP: ClassVar[dict[str, str]] = {
98-
"LessThan": "<",
99-
"GreaterThan": ">"
100-
}

0 commit comments

Comments
 (0)