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)
2925from 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 )
0 commit comments