From 2fafe64c51e297caf9bb117a4b104525c821b758 Mon Sep 17 00:00:00 2001 From: Shekhar Saxena Date: Thu, 19 Sep 2024 13:47:13 +0530 Subject: [PATCH] code refactoring Signed-off-by: Shekhar Saxena --- .../rest_apis/test_create_experiment.py | 26 +------------------ .../rest_apis/test_list_recommendations.py | 9 ------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/tests/scripts/local_monitoring_tests/rest_apis/test_create_experiment.py b/tests/scripts/local_monitoring_tests/rest_apis/test_create_experiment.py index 5ead7ee0e..9075a2741 100644 --- a/tests/scripts/local_monitoring_tests/rest_apis/test_create_experiment.py +++ b/tests/scripts/local_monitoring_tests/rest_apis/test_create_experiment.py @@ -22,31 +22,6 @@ from helpers.utils import * from jinja2 import Environment, FileSystemLoader -mandatory_fields = [ - ("version", ERROR_STATUS_CODE, ERROR_STATUS), - ("cluster_name", ERROR_STATUS_CODE, ERROR_STATUS), - ("experiment_name", ERROR_STATUS_CODE, ERROR_STATUS), - ("mode", ERROR_STATUS_CODE, ERROR_STATUS), - ("target_cluster", ERROR_STATUS_CODE, ERROR_STATUS), - ("kubernetes_objects", ERROR_STATUS_CODE, ERROR_STATUS), - ("type", ERROR_STATUS_CODE, ERROR_STATUS), - ("kubernetes_objects_name", ERROR_STATUS_CODE, ERROR_STATUS), - ("namespace", ERROR_STATUS_CODE, ERROR_STATUS), - ("containers", ERROR_STATUS_CODE, ERROR_STATUS), - ("container_image_name", ERROR_STATUS_CODE, ERROR_STATUS), - ("container_name", ERROR_STATUS_CODE, ERROR_STATUS), - ("selector", SUCCESS_STATUS_CODE, SUCCESS_STATUS), - ("namespace", ERROR_STATUS_CODE, ERROR_STATUS), - ("performance_profile", ERROR_STATUS_CODE, ERROR_STATUS), - ("slo", SUCCESS_STATUS_CODE, SUCCESS_STATUS), - ("recommendation_settings", ERROR_STATUS_CODE, ERROR_STATUS), - ("trial_settings", ERROR_STATUS_CODE, ERROR_STATUS), - ("kubernetes_objects_name_selector", ERROR_STATUS_CODE, ERROR_STATUS), - ("performance_profile_slo", ERROR_STATUS_CODE, ERROR_STATUS) -] - -csvfile = "/tmp/create_exp_test_data.csv" - @pytest.mark.sanity @pytest.mark.parametrize("test_name, expected_status_code, version, experiment_name, cluster_name, performance_profile, mode, target_cluster, datasource, experiment_type, kubernetes_obj_type, name, namespace, namespace_name, container_image_name, container_name, measurement_duration, threshold", [ @@ -249,6 +224,7 @@ def test_create_multiple_namespace_exp(cluster_type): assert response.status_code == ERROR_STATUS_CODE assert data['status'] == ERROR_STATUS + assert data['message'] == CREATE_EXP_BULK_ERROR_MSG response = delete_experiment(input_json_file) print("delete exp = ", response.status_code) diff --git a/tests/scripts/local_monitoring_tests/rest_apis/test_list_recommendations.py b/tests/scripts/local_monitoring_tests/rest_apis/test_list_recommendations.py index d0c5d447c..5eda0d6dd 100644 --- a/tests/scripts/local_monitoring_tests/rest_apis/test_list_recommendations.py +++ b/tests/scripts/local_monitoring_tests/rest_apis/test_list_recommendations.py @@ -61,15 +61,6 @@ def test_list_recommendations_namespace_single_result(test_name, expected_status environment = Environment(loader=FileSystemLoader("../json_files/")) template = environment.get_template("create_exp_template.json") - # In case of test_name with "null", strip the specific fields - if "null" in test_name: - field = test_name.replace("null_", "") - json_file = "../json_files/create_exp_template.json" - filename = "/tmp/create_exp_template.json" - strip_double_quotes_for_field(json_file, field, filename) - environment = Environment(loader=FileSystemLoader("/tmp/")) - template = environment.get_template("create_exp_template.json") - # Render the JSON content from the template content = template.render( version=version,