Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
Mahesh Shetty authored and Mahesh Shetty committed Jan 6, 2025
1 parent 325a89a commit 72f0180
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
8 changes: 8 additions & 0 deletions ocs_ci/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 72f0180

Please sign in to comment.