Skip to content
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

Perform Mon & OSD failure tests in Stretch cluster #9319

Merged
merged 6 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions ocs_ci/ocs/resources/stretchcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
get_mon_pods,
get_mon_pod_id,
get_pod_node,
get_osd_pods,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -665,3 +666,46 @@ def post_failure_checks(
failure_check_map[type](
start_time, end_time, wait_for_read_completion=wait_for_read_completion
)

def get_mon_pods_in_a_zone(self, zone):
"""
Fetches mon pods in a particular zone

Args:
zone (str): Zone

Returns:
List: mon pods in a zone

"""
nodes_in_zone = [node.name for node in self.get_nodes_in_zone(zone)]
mon_pods = [
Pod(**pod_info)
for pod_info in get_pods_having_label(
label=constants.MON_APP_LABEL, statuses=["Running"]
)
]
mon_pods_in_zone = [
pod for pod in mon_pods if get_pod_node(pod).name in nodes_in_zone
]
return mon_pods_in_zone

def get_osd_pods_in_a_zone(self, zone):
"""
Fetches osd osd pods in particular zone

Args:
zone (str): Zone

Returns:
List: OSD pods in a zone

"""

nodes_in_zone = [node.name for node in self.get_nodes_in_zone(zone)]
osd_pods = get_osd_pods()

osd_pods_in_zone = [
pod for pod in osd_pods if get_pod_node(pod).name in nodes_in_zone
]
return osd_pods_in_zone
83 changes: 83 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7066,6 +7066,15 @@ def finalizer():

@pytest.fixture()
def logwriter_cephfs_many_pvc_factory(request, pvc_factory):
return logwriter_cephfs_many_pvc(request, pvc_factory)


@pytest.fixture(scope="class")
def logwriter_cephfs_many_pvc_class(request, pvc_factory_class):
return logwriter_cephfs_many_pvc(request, pvc_factory_class)


def logwriter_cephfs_many_pvc(request, pvc_factory):
"""
Fixture to create RWX cephfs volume

Expand All @@ -7091,8 +7100,17 @@ def setup_stretch_cluster_project(request, project_factory_session):
return project_factory_session(constants.STRETCH_CLUSTER_NAMESPACE)


@pytest.fixture(scope="class")
def logwriter_workload_class(request, teardown_factory_class):
return setup_logwriter_workload(request, teardown_factory_class)


@pytest.fixture()
def logwriter_workload_factory(request, teardown_factory):
return setup_logwriter_workload(request, teardown_factory)


def setup_logwriter_workload(request, teardown_factory):
"""
Fixture to create logwriter deployment

Expand Down Expand Up @@ -7140,8 +7158,17 @@ def factory(pvc, logwriter_path):
return factory


@pytest.fixture(scope="class")
def logreader_workload_class(request, teardown_factory_class):
return setup_logreader_workload(request, teardown_factory_class)


@pytest.fixture()
def logreader_workload_factory(request, teardown_factory):
return setup_logreader_workload(request, teardown_factory)


def setup_logreader_workload(request, teardown_factory):
def factory(pvc, logreader_path, duration=30):
"""
Args:
Expand Down Expand Up @@ -7188,6 +7215,26 @@ def factory(pvc, logreader_path, duration=30):
return factory


@pytest.fixture(scope="class")
def setup_logwriter_cephfs_workload_class(
request,
setup_stretch_cluster_project,
pvc_factory_class,
logwriter_cephfs_many_pvc_class,
logwriter_workload_class,
logreader_workload_class,
):

return setup_logwriter_cephfs_workload(
request,
setup_stretch_cluster_project,
pvc_factory_class,
logwriter_cephfs_many_pvc_class,
logwriter_workload_class,
logreader_workload_class,
)


@pytest.fixture()
def setup_logwriter_cephfs_workload_factory(
request,
Expand All @@ -7197,6 +7244,25 @@ def setup_logwriter_cephfs_workload_factory(
logwriter_workload_factory,
logreader_workload_factory,
):

return setup_logwriter_cephfs_workload(
request,
setup_stretch_cluster_project,
pvc_factory,
logwriter_cephfs_many_pvc_factory,
logwriter_workload_factory,
logreader_workload_factory,
)


def setup_logwriter_cephfs_workload(
request,
setup_stretch_cluster_project,
pvc_factory,
logwriter_cephfs_many_pvc_factory,
logwriter_workload_factory,
logreader_workload_factory,
):
"""
This fixture will create the RWX cephfs volume and call the logwriter, logreader fixture to do
complete setup
Expand Down Expand Up @@ -7228,9 +7294,26 @@ def factory(read_duration=30):
return factory


@pytest.fixture(scope="class")
def setup_logwriter_rbd_workload_class(
request, setup_stretch_cluster_project, teardown_factory_class
):
return setup_logwriter_rbd_workload(
request, setup_stretch_cluster_project, teardown_factory_class
)


@pytest.fixture()
def setup_logwriter_rbd_workload_factory(
request, setup_stretch_cluster_project, teardown_factory
):
return setup_logwriter_rbd_workload(
request, setup_stretch_cluster_project, teardown_factory
)


def setup_logwriter_rbd_workload(
request, setup_stretch_cluster_project, teardown_factory
):
"""
This fixture will create the RWO RBD volume, create logwriter sts using that volume
Expand Down
Loading
Loading