Skip to content

Commit e5a5f72

Browse files
committed
Tag SELinux tests that require SELinux warning controller
The controller is available only with SELinuxChangePolicy FG enabled. Kubernetes e2e jobs do the right --focus & --skip explicitly in the SELinux jobs, this just helps other test runners to figure out what FGs are needed to run the tests. When at it, I noticed SELinuxMountReadWriteOncePod tag is always required, so add it on the common level and not in each test.
1 parent 88dfcb2 commit e5a5f72

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

test/e2e/storage/csimock/csi_selinux_mount.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
460460
secondPodFailureEvent string
461461
expectNodeIncreases sets.Set[string] // For testing kubelet metrics
462462
expectControllerConflictProperty string // For testing SELinuxWarningController metrics + events
463-
testTags []interface{}
463+
testTags []interface{} // SELinuxMountReadWriteOncePod and SELinuxChangePolicy are always added automatically
464464
}{
465465
{
466466
name: "warning is not bumped on two Pods with the same context on RWO volume",
@@ -470,7 +470,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
470470
volumeMode: v1.ReadWriteOnce,
471471
waitForSecondPodStart: true,
472472
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
473-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), feature.SELinuxMountReadWriteOncePodOnly},
473+
testTags: []interface{}{feature.SELinuxMountReadWriteOncePodOnly},
474474
},
475475
{
476476
name: "warning is bumped on two Pods with a different context on RWO volume",
@@ -481,7 +481,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
481481
waitForSecondPodStart: true,
482482
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_warnings_total"),
483483
expectControllerConflictProperty: "SELinuxLabel",
484-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), feature.SELinuxMountReadWriteOncePodOnly},
484+
testTags: []interface{}{feature.SELinuxMountReadWriteOncePodOnly},
485485
},
486486
{
487487
name: "warning is bumped on two Pods with different policies on RWO volume",
@@ -494,7 +494,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
494494
waitForSecondPodStart: true,
495495
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_warnings_total"),
496496
expectControllerConflictProperty: "SELinuxChangePolicy",
497-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), feature.SELinuxMountReadWriteOncePodOnly},
497+
testTags: []interface{}{feature.SELinuxMountReadWriteOncePodOnly},
498498
},
499499
{
500500
name: "warning is not bumped on two Pods with Recursive policy and a different context on RWO volume",
@@ -507,7 +507,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
507507
waitForSecondPodStart: true,
508508
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
509509
expectControllerConflictProperty: "", /* SELinuxController does not emit any warning either */
510-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxChangePolicy), feature.SELinuxMountReadWriteOncePodOnly},
510+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxChangePolicy), feature.SELinuxMountReadWriteOncePodOnly},
511511
},
512512
{
513513
name: "error is not bumped on two Pods with the same context on RWO volume and SELinuxMount enabled",
@@ -517,7 +517,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
517517
volumeMode: v1.ReadWriteOnce,
518518
waitForSecondPodStart: true,
519519
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
520-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
520+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
521521
},
522522
{
523523
name: "error is bumped on two Pods with a different context on RWO volume and SELinuxMount enabled",
@@ -529,7 +529,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
529529
waitForSecondPodStart: false,
530530
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
531531
expectControllerConflictProperty: "SELinuxLabel",
532-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
532+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
533533
},
534534
{
535535
name: "error is bumped on two Pods with a different policy on RWO volume and SELinuxMount enabled (nil + Recursive)",
@@ -543,7 +543,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
543543
waitForSecondPodStart: false,
544544
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
545545
expectControllerConflictProperty: "SELinuxChangePolicy",
546-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
546+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
547547
},
548548
{
549549
name: "error is bumped on two Pods with a different policy on RWO volume and SELinuxMount enabled (Recursive + nil)",
@@ -557,7 +557,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
557557
waitForSecondPodStart: false,
558558
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
559559
expectControllerConflictProperty: "SELinuxChangePolicy",
560-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
560+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
561561
},
562562
{
563563
name: "error is bumped on two Pods with a different policy on RWO volume and SELinuxMount enabled (Recursive + MountOption)",
@@ -571,7 +571,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
571571
waitForSecondPodStart: false,
572572
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
573573
expectControllerConflictProperty: "SELinuxChangePolicy",
574-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
574+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
575575
},
576576
{
577577
name: "error is bumped on two Pods with a different context on RWX volume and SELinuxMount enabled",
@@ -583,7 +583,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
583583
waitForSecondPodStart: false,
584584
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
585585
expectControllerConflictProperty: "SELinuxLabel",
586-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
586+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
587587
},
588588
{
589589
name: "error is not bumped on two Pods with Recursive policy and a different context on RWX volume",
@@ -596,7 +596,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
596596
waitForSecondPodStart: true,
597597
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
598598
expectControllerConflictProperty: "", /* SELinuxController does not emit any warning either */
599-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxChangePolicy), framework.WithFeatureGate(features.SELinuxMount)},
599+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
600600
},
601601
{
602602
name: "error is not bumped on two Pods with a different policy RWX volume (nil + MountOption)",
@@ -608,7 +608,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
608608
volumeMode: v1.ReadWriteMany,
609609
waitForSecondPodStart: true,
610610
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
611-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxChangePolicy), framework.WithFeatureGate(features.SELinuxMount)},
611+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
612612
},
613613
{
614614
name: "error is not bumped on two Pods with a different policy RWX volume (MountOption + MountOption)",
@@ -620,7 +620,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
620620
volumeMode: v1.ReadWriteMany,
621621
waitForSecondPodStart: true,
622622
expectNodeIncreases: sets.New[string]( /* no metric is increased, admitted_total was already increased when the first pod started */ ),
623-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxChangePolicy), framework.WithFeatureGate(features.SELinuxMount)},
623+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
624624
},
625625
{
626626
name: "error is bumped on two Pods with a different context on RWOP volume",
@@ -646,7 +646,7 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
646646
waitForSecondPodStart: false,
647647
expectNodeIncreases: sets.New[string]("volume_manager_selinux_volume_context_mismatch_errors_total"),
648648
expectControllerConflictProperty: "SELinuxLabel",
649-
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod), framework.WithFeatureGate(features.SELinuxMount)},
649+
testTags: []interface{}{framework.WithFeatureGate(features.SELinuxMount)},
650650
},
651651
}
652652
for _, t := range tests {
@@ -731,6 +731,8 @@ var _ = utils.SIGDescribe("CSI Mock selinux on mount metrics and SELinuxWarningC
731731
args := []interface{}{
732732
t.name,
733733
testFunc,
734+
framework.WithFeatureGate(features.SELinuxMountReadWriteOncePod),
735+
framework.WithFeatureGate(features.SELinuxChangePolicy),
734736
}
735737
args = append(args, t.testTags...)
736738
framework.It(args...)

0 commit comments

Comments
 (0)