From 72f0180bab10500d4a570d62dfe28dcd92777b2a Mon Sep 17 00:00:00 2001 From: Mahesh Shetty Date: Mon, 6 Jan 2025 12:57:15 +0530 Subject: [PATCH] fix up Signed-off-by: Mahesh Shetty --- ocs_ci/helpers/helpers.py | 8 ++++++++ .../sc_arbiter/test_zone_unaware_app.py | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ocs_ci/helpers/helpers.py b/ocs_ci/helpers/helpers.py index 9675aeed7cf..11fdf196a55 100644 --- a/ocs_ci/helpers/helpers.py +++ b/ocs_ci/helpers/helpers.py @@ -5673,6 +5673,13 @@ def create_network_fence(node_name, cidr): """ Create NetworkFence for the node + Args: + node_name (str): Name of the node + cidr (str): cidr + + Returns: + OCS: NetworkFence object + """ logger.info("Creating NetworkFence") network_fence_dict = templating.load_yaml(constants.NETWORK_FENCE_CRD) @@ -5683,6 +5690,7 @@ def create_network_fence(node_name, cidr): logger.info( f"NetworkFence {network_fence_obj.name} for node {node_name} created successfully" ) + return network_fence_obj def unfence_node(node_name): diff --git a/tests/functional/disaster-recovery/sc_arbiter/test_zone_unaware_app.py b/tests/functional/disaster-recovery/sc_arbiter/test_zone_unaware_app.py index 2951ede559a..f02a9360718 100644 --- a/tests/functional/disaster-recovery/sc_arbiter/test_zone_unaware_app.py +++ b/tests/functional/disaster-recovery/sc_arbiter/test_zone_unaware_app.py @@ -109,15 +109,15 @@ def finalizer(): @pytest.mark.parametrize( argnames="fencing", argvalues=[ - pytest.param( - True, - ), + # pytest.param( + # True, + # ), pytest.param( False, ), ], ids=[ - "With-Fencing", + # "With-Fencing", "Without-Fencing", ], ) @@ -171,6 +171,7 @@ def test_zone_shutdowns( ) log.info(f"Nodes of zone {zone} are shutdown successfully") + network_fence_objs = [] if fencing: # If fencing is True, then we need to fence the nodes after shutdown @@ -195,8 +196,10 @@ def test_zone_shutdowns( ] # Create the network fence - retry(CommandFailed, tries=5)(create_network_fence)( - node.name, cidr=cidrs[0] + network_fence_objs.append( + retry(CommandFailed, tries=5)(create_network_fence)( + node.name, cidr=cidrs[0] + ) ) # Taint the nodes that are shutdown @@ -267,6 +270,10 @@ def test_zone_shutdowns( "Successfully removed taints from the nodes that were shutdown" ) + # Delete NetworkFence objects for each of the nodes + for network_fence in network_fence_objs: + network_fence.delete() + # Start the nodes that were shutdown log.info(f"Starting the {zone} nodes") try: