From aa6b40b2aa204b057c5f3109b1ecd3d7d29b443e Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Fri, 19 Dec 2025 14:44:59 +0100 Subject: [PATCH] Added e2e tests with disabled SELinux Added few tests with a CSI driver that does not support SELinux and has it disabled in its CSIDriver instance --- test/e2e/storage/csimock/csi_selinux_mount.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/e2e/storage/csimock/csi_selinux_mount.go b/test/e2e/storage/csimock/csi_selinux_mount.go index 2c6012035e6..08c0e548579 100644 --- a/test/e2e/storage/csimock/csi_selinux_mount.go +++ b/test/e2e/storage/csimock/csi_selinux_mount.go @@ -752,6 +752,50 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC expectNodeIncreases: sets.New[string]("volume_manager_selinux_volumes_admitted_total"), testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)}, }, + { + name: "warning is not bumped on RWO volume with CSIDriver.SELinuxMount disabled and mismatched labels", + csiDriverSELinuxEnabled: false, + firstPodSELinuxOpts: &seLinuxOpts1, + secondPodSELinuxOpts: &seLinuxOpts2, + volumeMode: v1.ReadWriteOnce, + waitForSecondPodStart: true, + expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ), + testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)}, + }, + { + name: "warning is not bumped on RWX volume with CSIDriver.SELinuxMount disabled and mismatched labels", + csiDriverSELinuxEnabled: false, + firstPodSELinuxOpts: &seLinuxOpts1, + secondPodSELinuxOpts: &seLinuxOpts2, + volumeMode: v1.ReadWriteMany, + waitForSecondPodStart: true, + expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ), + testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)}, + }, + { + name: "warning is not bumped on RWO volume with CSIDriver.SELinuxMount disabled and mismatched policies", + csiDriverSELinuxEnabled: false, + firstPodSELinuxOpts: &seLinuxOpts1, + firstPodChangePolicy: &recursive, + secondPodSELinuxOpts: &seLinuxOpts1, + secondPodChangePolicy: &mount, + volumeMode: v1.ReadWriteOnce, + waitForSecondPodStart: true, + expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ), + testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)}, + }, + { + name: "warning is not bumped on RWX volume with CSIDriver.SELinuxMount disabled and mismatched policies", + csiDriverSELinuxEnabled: false, + firstPodSELinuxOpts: &seLinuxOpts1, + firstPodChangePolicy: &recursive, + secondPodSELinuxOpts: &seLinuxOpts1, + secondPodChangePolicy: &mount, + volumeMode: v1.ReadWriteMany, + waitForSecondPodStart: true, + expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ), + testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)}, + }, } for _, t := range tests { t := t