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
This commit is contained in:
Jan Safranek
2025-12-19 14:44:59 +01:00
parent 6e491604a4
commit aa6b40b2aa

View File

@@ -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