Skip to content

Commit

Permalink
address review comments from Petr
Browse files Browse the repository at this point in the history
decorate tests with role markers

Signed-off-by: Shylesh Kumar Mohan <[email protected]>
  • Loading branch information
shylesh committed Nov 6, 2023
1 parent 8502c3b commit 9bd91f1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions ocs_ci/framework/pytest_customization/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,4 @@

# Mark for Multicluster upgrade scenarios
config_index = pytest.mark.config_index
multicluster_roles = pytest.mark.multicluster_roles
16 changes: 5 additions & 11 deletions ocs_ci/utility/multicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

from ocs_ci.ocs.constants import mdr_roles
from ocs_ci.framework import config as ocsci_config
from ocs_ci.ocs.utils import (
get_primary_cluster_index,
Expand Down Expand Up @@ -100,7 +99,7 @@ def __init__(self):
self.zone_role_map = dict()

self.zones = self.get_zone_info()
self.mdr_roles = self.get_mdr_roles()
self.mdr_roles = self.get_roles()
self.generate_zone_ranks()
self.generate_role_ranks()
self.generate_role_to_param_tuple_map()
Expand Down Expand Up @@ -128,13 +127,6 @@ def generate_config_index_map(self):
# Only option left is secondary odf
self.roles_to_config_index_map["Secondary_odf"] = cluster_index

def get_mdr_roles(self):
"""
All MDR applicable roles
"""
return mdr_roles

def generate_role_ranks(self):
"""
Based on current roles for MDR : ActiveACM:1, PassiceACM:1, Primary:2, Secondary: 2
Expand Down Expand Up @@ -190,7 +182,7 @@ def get_pytest_params_tuple(self, role):
def get_roles(self, metafunc):
# Return a list of roles applicable to the current test
for marker in metafunc.definition.iter_markers():
if marker.name == "mdr_roles":
if marker.name == "multicluster_roles":
return marker.args[0]

def generate_pytest_parameters(self, metafunc, roles):
Expand All @@ -209,4 +201,6 @@ def generate_pytest_parameters(self, metafunc, roles):


def get_multicluster_upgrade_parametrizer():
return multicluster_upgrade_parametrizer["metro-dr"]()
return multicluster_upgrade_parametrizer[
ocsci_config.MULTICLUSTER["multicluster_mode"]
]()
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def pytest_generate_tests(metafunc):
Args:
metafunc (pytest fixture): metafunc pytest object to access info about
test function and its parameters
test function and its parameters
"""
# For now we are only dealing with multicluster scenarios in this hook
Expand Down
3 changes: 2 additions & 1 deletion tests/ecosystem/upgrade/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from ocs_ci.framework.pytest_customization.marks import purple_squad
from ocs_ci.framework.pytest_customization.marks import purple_squad, multicluster_roles
from ocs_ci.framework.testlib import (
ocs_upgrade,
polarion_id,
Expand Down Expand Up @@ -64,6 +64,7 @@ def test_osd_reboot(teardown):
@purple_squad
@ocs_upgrade
@polarion_id(get_polarion_id(upgrade=True))
@multicluster_roles(["odf"])
def test_upgrade():
"""
Tests upgrade procedure of OCS cluster
Expand Down
2 changes: 2 additions & 0 deletions tests/ecosystem/upgrade/test_upgrade_ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
)
from ocs_ci.framework.pytest_customization.marks import (
purple_squad,
multicluster_roles,
)

logger = logging.getLogger(__name__)
Expand All @@ -35,6 +36,7 @@
@ignore_leftovers
@ocp_upgrade
@purple_squad
@multicluster_roles(["ocp"])
class TestUpgradeOCP(ManageTest):
"""
1. check cluster health
Expand Down

0 comments on commit 9bd91f1

Please sign in to comment.