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

trim testcase path for test_pods_csi_log_rotation #11117

Merged
Merged
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
21 changes: 15 additions & 6 deletions tests/functional/pod_and_daemons/test_csi_logs_rotation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
import logging
import os
import pytest

from ocs_ci.framework import config
Expand Down Expand Up @@ -108,47 +109,42 @@ def pump_logs_and_wait_for_rotation(self, pod_obj, logs_dir, log_file_name):
@pytest.mark.parametrize(
argnames=[
"pod_selector",
"logs_dir",
"log_file_name",
"additional_log_file_name",
],
argvalues=[
pytest.param(
*[
"csi-cephfsplugin",
"/var/lib/rook/openshift-storage.cephfs.csi.ceph.com/log/node-plugin/",
"csi-cephfsplugin.log",
"",
],
),
pytest.param(
*[
"csi-rbdplugin",
"/var/lib/rook/openshift-storage.rbd.csi.ceph.com/log/node-plugin/",
"csi-rbdplugin.log",
"",
],
),
pytest.param(
*[
"csi-cephfsplugin-provisioner",
"/var/lib/rook/openshift-storage.cephfs.csi.ceph.com/log/controller-plugin/",
"csi-cephfsplugin.log",
"csi-addons.log",
],
),
pytest.param(
*[
"csi-rbdplugin-provisioner",
"/var/lib/rook/openshift-storage.rbd.csi.ceph.com/log/controller-plugin/",
"csi-rbdplugin.log",
"csi-addons.log",
],
),
],
)
def test_pods_csi_log_rotation(
self, pod_selector, logs_dir, log_file_name, additional_log_file_name
self, pod_selector, log_file_name, additional_log_file_name
):
"""
Tests that the both log files on provisioner pod are rotated correctly.
Expand All @@ -160,6 +156,19 @@ def test_pods_csi_log_rotation(
additional_log_file_name (str) Additional log file name; empty string if is not relevant

"""
base_dir = "/var/lib/rook/"
suffix_dir = ""
if pod_selector == "csi-cephfsplugin":
suffix_dir = "openshift-storage.cephfs.csi.ceph.com/log/node-plugin/"
elif pod_selector == "csi-rbdplugin":
suffix_dir = "openshift-storage.rbd.csi.ceph.com/log/node-plugin/"
elif pod_selector == "csi-cephfsplugin-provisioner":
suffix_dir = "openshift-storage.cephfs.csi.ceph.com/log/controller-plugin/"
elif pod_selector == "csi-rbdplugin-provisioner":
suffix_dir = "openshift-storage.rbd.csi.ceph.com/log/controller-plugin/"

logs_dir = os.path.join(base_dir, suffix_dir)
log.debug(f"logs dir: {logs_dir}")
csi_interface_plugin_pod_objs = pod.get_all_pods(
namespace=config.ENV_DATA["cluster_namespace"], selector=[pod_selector]
)
Expand Down
Loading