Skip to content

Commit

Permalink
Merge pull request #11117 from vavuthu/trim_too_long_testcase_path
Browse files Browse the repository at this point in the history
trim testcase path for test_pods_csi_log_rotation
  • Loading branch information
petr-balogh authored Jan 7, 2025
2 parents 27ec5a6 + 4c80630 commit ac80ed5
Showing 1 changed file with 15 additions and 6 deletions.
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

0 comments on commit ac80ed5

Please sign in to comment.