Skip to content

Commit

Permalink
Update dr_workload fixture and test_failover_and_relocate.py
Browse files Browse the repository at this point in the history
 - Use pull model by default for ODF 4.16+
 - Remove redundant tests for pull model

Signed-off-by: Sidhant Agrawal <[email protected]>
  • Loading branch information
sidhant-agrawal committed May 28, 2024
1 parent 126c801 commit cc516a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 52 deletions.
10 changes: 7 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6473,19 +6473,19 @@ def dr_workload(request):
def factory(
num_of_subscription=1,
num_of_appset=0,
appset_model="pull",
appset_model=None,
pvc_interface=constants.CEPHBLOCKPOOL,
switch_ctx=None,
):
"""
Args:
num_of_subscription (int): Number of Subscription type workload to be created
num_of_appset (int): Number of ApplicationSet type workload to be created
appset_model (str): GitOps ApplicationSet deployment model. Valid values include "pull" or "push".
ODF 4.16 onwards, "pull" model is the default if not user-provided.
pvc_interface (str): 'CephBlockPool' or 'CephFileSystem'.
This decides whether a RBD based or CephFS based resource is created. RBD is default.
switch_ctx (int): The cluster index by the cluster name
appset_model (str): Appset Gitops deployment now supports "pull" model starting ACM 2.10 which is now the
default selection in addition to "push" model.
Raises:
ResourceNotDeleted: In case workload resources not deleted properly
Expand All @@ -6500,6 +6500,10 @@ def factory(
if pvc_interface == constants.CEPHFILESYSTEM:
workload_key = "dr_workload_subscription_cephfs"

if num_of_appset > 0 and appset_model is None:
ocs_version = version.get_semantic_ocs_version_from_config()
appset_model = "pull" if ocs_version >= version.VERSION_4_16 else "push"

for index in range(num_of_subscription):
workload_details = ocsci_config.ENV_DATA[workload_key][index]
workload = BusyBox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import pytest

from ocs_ci.framework import config
from ocs_ci.framework.pytest_customization.marks import (
turquoise_squad,
skipif_ocs_version,
)
from ocs_ci.framework.pytest_customization.marks import turquoise_squad
from ocs_ci.framework.testlib import acceptance, tier1
from ocs_ci.helpers import dr_helpers
from ocs_ci.helpers.dr_helpers_ui import (
Expand All @@ -32,8 +29,6 @@
polarion_id_primary_down = "OCS-4427"
polarion_id_primary_down_appset = "OCS-5009"
polarion_id_primary_up_appset = "OCS-5010"
polarion_id_primary_up_appset_pull = None
polarion_id_primary_down_appset_pull = None


if config.RUN.get("rdr_failover_via_ui"):
Expand All @@ -52,55 +47,31 @@ class TestFailoverAndRelocate:
"""

@pytest.mark.parametrize(
argnames=["workload_type", "primary_cluster_down", "appset_model"],
argnames=["workload_type", "primary_cluster_down"],
argvalues=[
pytest.param(
constants.SUBSCRIPTION,
False,
None,
marks=pytest.mark.polarion_id(polarion_id_primary_up),
id="primary_up_subscription",
),
pytest.param(
constants.SUBSCRIPTION,
True,
None,
marks=pytest.mark.polarion_id(polarion_id_primary_down),
id="primary_down_subscription",
),
pytest.param(
constants.APPLICATION_SET,
False,
"push",
marks=pytest.mark.polarion_id(polarion_id_primary_up_appset),
id="primary_up_appset_push",
),
pytest.param(
constants.APPLICATION_SET,
False,
"pull",
marks=[
pytest.mark.polarion_id(polarion_id_primary_up_appset_pull),
skipif_ocs_version("<4.16"),
],
id="primary_up_appset_pull",
id="primary_up_appset",
),
pytest.param(
constants.APPLICATION_SET,
True,
"push",
marks=pytest.mark.polarion_id(polarion_id_primary_down_appset),
id="primary_down_appset_push",
),
pytest.param(
constants.APPLICATION_SET,
True,
"pull",
marks=[
pytest.mark.polarion_id(polarion_id_primary_down_appset_pull),
skipif_ocs_version("<4.16"),
],
id="primary_down_appset_pull",
id="primary_down_appset",
),
],
)
Expand All @@ -110,7 +81,6 @@ def test_failover_and_relocate(
setup_acm_ui,
dr_workload,
workload_type,
appset_model,
nodes_multicluster,
node_restart_teardown,
):
Expand All @@ -126,8 +96,6 @@ def test_failover_and_relocate(
pass the yaml conf/ocsci/dr_ui.yaml to trigger it.
The value of lastGroupSyncTime is verified in each stage.
appset_model pull type was introduced with ACM 2.10 and would be supported with ODF 4.16 and above
"""
if config.RUN.get("rdr_failover_via_ui"):
acm_obj = AcmAddClusters()
Expand All @@ -136,9 +104,7 @@ def test_failover_and_relocate(
rdr_workload = dr_workload(num_of_subscription=1)[0]
drpc_obj = DRPC(namespace=rdr_workload.workload_namespace)
else:
rdr_workload = dr_workload(
num_of_subscription=0, num_of_appset=1, appset_model=appset_model
)[0]
rdr_workload = dr_workload(num_of_subscription=0, num_of_appset=1)[0]
drpc_obj = DRPC(
namespace=constants.GITOPS_CLUSTER_NAMESPACE,
resource_name=f"{rdr_workload.appset_placement_name}-drpc",
Expand Down Expand Up @@ -230,11 +196,9 @@ def test_failover_and_relocate(
secondary_cluster_name,
rdr_workload.workload_namespace,
workload_type,
(
rdr_workload.appset_placement_name
if workload_type != constants.SUBSCRIPTION
else None
),
rdr_workload.appset_placement_name
if workload_type != constants.SUBSCRIPTION
else None,
)

# Verify resources creation on secondary cluster (failoverCluster)
Expand Down Expand Up @@ -338,11 +302,9 @@ def test_failover_and_relocate(
primary_cluster_name,
rdr_workload.workload_namespace,
workload_type,
(
rdr_workload.appset_placement_name
if workload_type != constants.SUBSCRIPTION
else None
),
rdr_workload.appset_placement_name
if workload_type != constants.SUBSCRIPTION
else None,
)

# Verify resources deletion from secondary cluster
Expand Down

0 comments on commit cc516a5

Please sign in to comment.