Skip to content

Commit 2010ca8

Browse files
authored
Merge pull request kubernetes#123849 from AkihiroSuda/fix-123848
e2e_node: mount_rro: skip if feature gate is disabled; fix error string comparison
2 parents b3926d1 + ea14ccd commit 2010ca8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/e2e_node/mount_rro_linux_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
v1 "k8s.io/api/core/v1"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
"k8s.io/apimachinery/pkg/util/uuid"
28+
"k8s.io/kubernetes/pkg/features"
2829
"k8s.io/kubernetes/test/e2e/framework"
2930
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
3031
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
@@ -122,19 +123,15 @@ var _ = SIGDescribe("Mount recursive read-only [LinuxOnly]", framework.WithSeria
122123
},
123124
},
124125
}
125-
pod = e2epod.NewPodClient(f).Create(ctx, pod)
126-
framework.ExpectNoError(e2epod.WaitForPodContainerToFail(ctx, f.ClientSet, pod.Namespace, pod.Name, 0, "CreateContainerConfigError", framework.PodStartShortTimeout))
127-
var err error
128-
pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
129-
framework.ExpectNoError(err)
130-
gomega.Expect(pod.Status.ContainerStatuses[0].State.Waiting.Message).To(
131-
gomega.ContainSubstring("failed to resolve recursive read-only mode: volume \"mnt\" requested recursive read-only mode, but it is not read-only"))
126+
_, err := f.ClientSet.CoreV1().Pods(pod.Namespace).Create(ctx, pod, metav1.CreateOptions{})
127+
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("spec.containers[0].volumeMounts.recursiveReadOnly: Forbidden: may only be specified when readOnly is true")))
132128
}) // By
133129
// See also the unit test [pkg/kubelet.TestResolveRecursiveReadOnly] for more invalid conditions (e.g., incompatible mount propagation)
134130
}) // It
135131
}) // Context
136132
ginkgo.Context("when the runtime does not support recursive read-only mounts", func() {
137133
f.It("should accept non-recursive read-only mounts", func(ctx context.Context) {
134+
e2eskipper.SkipUnlessFeatureGateEnabled(features.RecursiveReadOnlyMounts)
138135
ginkgo.By("waiting for the node to be ready", func() {
139136
waitForNodeReady(ctx)
140137
if supportsRRO(ctx, f) {
@@ -175,6 +172,7 @@ var _ = SIGDescribe("Mount recursive read-only [LinuxOnly]", framework.WithSeria
175172
}) // By
176173
}) // It
177174
f.It("should reject recursive read-only mounts", func(ctx context.Context) {
175+
e2eskipper.SkipUnlessFeatureGateEnabled(features.RecursiveReadOnlyMounts)
178176
ginkgo.By("waiting for the node to be ready", func() {
179177
waitForNodeReady(ctx)
180178
if supportsRRO(ctx, f) {

0 commit comments

Comments
 (0)