Skip to content

Commit 7e63a31

Browse files
authored
Update split tests to use delete and create lib function (#7418)
use delete and create
1 parent 67ea414 commit 7e63a31

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tests/suite/test_v_s_route_weight_changes_dynamic_reload_many_splits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from tests.suite.utils.vs_vsr_resources_utils import (
1919
create_v_s_route_from_yaml,
2020
create_virtual_server_from_yaml,
21-
patch_v_s_route_from_yaml,
21+
delete_and_create_v_s_route_from_yaml,
2222
)
2323

2424

@@ -163,7 +163,7 @@ def test_vsr_weight_changes_dynamic_reload_many_splits(
163163
assert "backend1" in resp.text
164164

165165
print("Step 2: Apply a configuration that swaps the weights (0 100) to (100 0).")
166-
patch_v_s_route_from_yaml(
166+
delete_and_create_v_s_route_from_yaml(
167167
kube_apis.custom_objects,
168168
vsr_weight_changes_dynamic_reload_many_splits_setup.route.name,
169169
swap_weights_config,

tests/suite/utils/vs_vsr_resources_utils.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,22 @@ def delete_v_s_route(custom_objects: CustomObjectsApi, name, namespace) -> None:
284284
name,
285285
)
286286
print(f"VirtualServerRoute was removed with the name '{name}'")
287+
288+
289+
def delete_and_create_v_s_route_from_yaml(custom_objects: CustomObjectsApi, name, yaml_manifest, namespace) -> None:
290+
"""
291+
Update a VirtualServerRoute based on yaml manifest
292+
293+
:param custom_objects: CustomObjectsApi
294+
:param name:
295+
:param yaml_manifest: an absolute path to file
296+
:param namespace:
297+
:return:
298+
"""
299+
try:
300+
delete_v_s_route(custom_objects, name, namespace)
301+
create_v_s_route_from_yaml(custom_objects, yaml_manifest, namespace)
302+
wait_before_test()
303+
except ApiException:
304+
logging.exception(f"Failed with exception while patching VirtualServerRoute: {name}")
305+
raise

0 commit comments

Comments
 (0)