Skip to content

Commit

Permalink
Update roles markers
Browse files Browse the repository at this point in the history
Signed-off-by: Shylesh Kumar Mohan <[email protected]>
  • Loading branch information
shylesh committed Nov 6, 2023
1 parent 9bd91f1 commit 5e2f2cd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ocs_ci/ocs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2329,4 +2329,4 @@
HTML_REPORT_TEMPLATE_DIR = "ocs_ci/templates/html_reports/"

# MDR multicluster roles
mdr_roles = ["ActiveACM", "PassiveACM", "Primary_odf", "Secondary_odf"]
MDR_ROLES = ["ActiveACM", "PassiveACM", "Primary_odf", "Secondary_odf"]
38 changes: 19 additions & 19 deletions ocs_ci/utility/multicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
get_active_acm_index,
get_all_acm_indexes,
)
from ocs_ci.ocs.constants import MDR_ROLES


class MutliClusterUpgradeParametrize(object):
Expand All @@ -31,7 +32,7 @@ class MutliClusterUpgradeParametrize(object):
def __init__(self):
self.roles = []
# List of zones which are participating in this multicluster setup
self.zones = []
self.zones = self.get_zone_info()
self.zone_base_rank = 100
# Each zone will be assigned with a rank
# This rank comes handy when we have to order the tests
Expand Down Expand Up @@ -97,23 +98,20 @@ def __init__(self):
self.roles_to_param_tuples = dict()
self.roles_to_config_index_map = dict()
self.zone_role_map = dict()
self.all_mdr_roles = MDR_ROLES

self.zones = self.get_zone_info()
self.mdr_roles = self.get_roles()
self.generate_zone_ranks()
self.generate_role_ranks()
self.generate_role_to_param_tuple_map()
self.generate_config_index_map()
self.generate_role_to_param_tuple_map()
self.generate_zone_role_map()

# In ocs-ci we need to build this based on the config provided
def get_config_index_map(self):
# TO BE built before pytest_generate_test
if not self.roles_to_config_index_map:
self.generate_config_index_map()
return self.roles_to_config_index_map

def generate_config_index_map(self):
"""
Generate config indexes for all the MDRs cluster roles
ex: {"ActiveACM": 0, "PassiceACM": 2, "PrimaryODF": 1, "SecondaryODF": 3}
"""
for cluster in ocsci_config:
cluster_index = cluster.MULTICLUSTER["multicluster_index"]
if cluster_index == get_active_acm_index():
Expand Down Expand Up @@ -143,7 +141,7 @@ def generate_role_ranks(self):
def generate_zone_role_map(self):
"""
Generate a map of Cluster's role vs zone in which clusters are located
ex: {"ActiveACM": 'a', "PassiveACM": 'b', "PrimaryODF": 'a'}
"""
for crole, cindex in self.roles_to_config_index_map.items():
czone = ocsci_config.clusters[cindex].ENV_DATA.get("zone")
Expand All @@ -153,22 +151,24 @@ def generate_zone_role_map(self):
def generate_role_to_param_tuple_map(self):
"""
For each of the MDRs applicable roles store a tuple (zone_rank, role_rank, config_index)
ex: {"ActiveACM": (1, 1, 0), "PassiceACM": (2, 1, 2), "PrimaryODF": (1, 2, 1), "SecondarODF": (2, 2, 3)}
"""
for role in self.mdr_roles:
for role in self.all_mdr_roles:
self.roles_to_param_tuples[role] = (
self.zone_ranks[self.zone_role_map[role]],
self.role_ranks[role],
self.get_config_index_map()[role],
self.roles_to_config_index_map[role],
)

def get_pytest_params_tuple(self, role):
"""
Generate a tuple of parameters applicable to the given role
For ex: if role is 'ActiveACM', then generate a tuple which is applicable to
that role. If the role is 'all' then we will generate tuple of parameter
for each of the role applicable from MDRs perspective.
Parmeter tuples looks like (zone_rank, role_rank, config_index)
Get a tuple of parameters applicable to the given role
For ex: if role is 'ActiveACM', then get a tuple which is applicable to
that role. If the role is 'all' then we will get tuples of parameter
for all the roles applicable
Parmeter tuples looks like (zone_rank, role_rank, config_index) for a given role
"""
param_list = list()
if role == "all":
Expand Down
2 changes: 1 addition & 1 deletion tests/ecosystem/upgrade/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_osd_reboot(teardown):
@purple_squad
@ocs_upgrade
@polarion_id(get_polarion_id(upgrade=True))
@multicluster_roles(["odf"])
@multicluster_roles(["mdr_all_ocs"])
def test_upgrade():
"""
Tests upgrade procedure of OCS cluster
Expand Down
3 changes: 1 addition & 2 deletions tests/ecosystem/upgrade/test_upgrade_ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@ignore_leftovers
@ocp_upgrade
@purple_squad
@multicluster_roles(["ocp"])
@multicluster_roles(["mdr_all_ocp"])
class TestUpgradeOCP(ManageTest):
"""
1. check cluster health
Expand Down Expand Up @@ -86,7 +86,6 @@ def test_upgrade_ocp(self, reduce_and_resume_cluster_load):
logger.debug(f"Cluster versions before upgrade:\n{cluster_ver}")
ceph_cluster = CephCluster()
with CephHealthMonitor(ceph_cluster):

ocp_channel = config.UPGRADE.get(
"ocp_channel", ocp.get_ocp_upgrade_channel()
)
Expand Down

0 comments on commit 5e2f2cd

Please sign in to comment.