Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Shekhar Saxena <[email protected]>
  • Loading branch information
shekhar316 committed Sep 19, 2024
1 parent e7b00c5 commit 2fafe64
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
[
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2fafe64

Please sign in to comment.