-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable dr #10442
Open
keemano
wants to merge
4
commits into
red-hat-storage:master
Choose a base branch
from
keemano:disable_dr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+151
−1
Open
disable dr #10442
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
tests/functional/disaster-recovery/regional-dr/test_disable_dr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import logging | ||
import pytest | ||
from time import sleep | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty line |
||
from ocs_ci.framework import config | ||
from ocs_ci.framework.testlib import tier1 | ||
from ocs_ci.framework.pytest_customization.marks import turquoise_squad | ||
from ocs_ci.helpers import dr_helpers | ||
from ocs_ci.ocs import constants | ||
from ocs_ci.ocs.resources.drpc import DRPC | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@rdr | ||
@tier1 | ||
keemano marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@turquoise_squad | ||
prsurve marked this conversation as resolved.
Show resolved
Hide resolved
|
||
class TestDisableDR: | ||
""" | ||
Test Disable Disaster Recovery | ||
|
||
""" | ||
|
||
@pytest.mark.parametrize( | ||
argnames=["pvc_interface"], | ||
argvalues=[ | ||
pytest.param( | ||
constants.CEPHBLOCKPOOL, | ||
marks=pytest.mark.polarion_id("OCS-6209"), | ||
), | ||
pytest.param( | ||
constants.CEPHFILESYSTEM, | ||
marks=pytest.mark.polarion_id("OCS-6241"), | ||
), | ||
], | ||
) | ||
def test_disable_dr(self, pvc_interface, dr_workload): | ||
""" | ||
Test to verify disable DR of application | ||
|
||
""" | ||
|
||
rdr_workload = dr_workload( | ||
num_of_subscription=1, num_of_appset=1, pvc_interface=pvc_interface | ||
) | ||
drpc_subscription = DRPC(namespace=rdr_workload[0].workload_namespace) | ||
drpc_appset = DRPC( | ||
namespace=constants.GITOPS_CLUSTER_NAMESPACE, | ||
resource_name=f"{rdr_workload[1].appset_placement_name}-drpc", | ||
) | ||
drpc_objs = [drpc_subscription, drpc_appset] | ||
|
||
scheduling_interval = dr_helpers.get_scheduling_interval( | ||
rdr_workload[0].workload_namespace, | ||
) | ||
wait_time = 2 * scheduling_interval # Time in minutes | ||
logger.info(f"Waiting for {wait_time} minutes to run IOs") | ||
sleep(wait_time * 60) | ||
|
||
# Check lastGroupSyncTime | ||
for drpc_obj in drpc_objs: | ||
dr_helpers.verify_last_group_sync_time(drpc_obj, scheduling_interval) | ||
|
||
logger.info("Verified the lastGroupSyncTime before disabling the DR") | ||
|
||
primary_cluster_name = dr_helpers.get_current_primary_cluster_name( | ||
rdr_workload[0].workload_namespace, | ||
) | ||
|
||
# Disable DR | ||
dr_helpers.disable_dr_rdr() | ||
am-agrawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Verify resources deletion from primary cluster | ||
config.switch_to_cluster_by_name(primary_cluster_name) | ||
|
||
# Verify replication resource deletion on primary cluster | ||
for workload in rdr_workload: | ||
logger.info( | ||
f"Validating replication resource deletion in namespace {workload.workload_namespace}..." | ||
) | ||
dr_helpers.wait_for_replication_resources_deletion( | ||
workload.workload_namespace, | ||
timeout=300, | ||
check_state=False, | ||
) | ||
# Verify pod status on primary cluster | ||
logger.info( | ||
f"Validate pods and pvc in {workload.workload_namespace} be in Running state" | ||
) | ||
dr_helpers.wait_for_all_resources_creation( | ||
workload.workload_pvc_count, | ||
workload.workload_pod_count, | ||
workload.workload_namespace, | ||
skip_replication_resources=True, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function has similarities to
ocs-ci/ocs_ci/helpers/dr_helpers.py
Line 1458 in 7686692
Can we merge them?