mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Merge pull request #123849 from AkihiroSuda/fix-123848
e2e_node: mount_rro: skip if feature gate is disabled; fix error string comparison
This commit is contained in:
commit
2010ca8c5a
@ -25,6 +25,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
@ -122,19 +123,15 @@ var _ = SIGDescribe("Mount recursive read-only [LinuxOnly]", framework.WithSeria
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
pod = e2epod.NewPodClient(f).Create(ctx, pod)
|
_, err := f.ClientSet.CoreV1().Pods(pod.Namespace).Create(ctx, pod, metav1.CreateOptions{})
|
||||||
framework.ExpectNoError(e2epod.WaitForPodContainerToFail(ctx, f.ClientSet, pod.Namespace, pod.Name, 0, "CreateContainerConfigError", framework.PodStartShortTimeout))
|
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("spec.containers[0].volumeMounts.recursiveReadOnly: Forbidden: may only be specified when readOnly is true")))
|
||||||
var err error
|
|
||||||
pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
gomega.Expect(pod.Status.ContainerStatuses[0].State.Waiting.Message).To(
|
|
||||||
gomega.ContainSubstring("failed to resolve recursive read-only mode: volume \"mnt\" requested recursive read-only mode, but it is not read-only"))
|
|
||||||
}) // By
|
}) // By
|
||||||
// See also the unit test [pkg/kubelet.TestResolveRecursiveReadOnly] for more invalid conditions (e.g., incompatible mount propagation)
|
// See also the unit test [pkg/kubelet.TestResolveRecursiveReadOnly] for more invalid conditions (e.g., incompatible mount propagation)
|
||||||
}) // It
|
}) // It
|
||||||
}) // Context
|
}) // Context
|
||||||
ginkgo.Context("when the runtime does not support recursive read-only mounts", func() {
|
ginkgo.Context("when the runtime does not support recursive read-only mounts", func() {
|
||||||
f.It("should accept non-recursive read-only mounts", func(ctx context.Context) {
|
f.It("should accept non-recursive read-only mounts", func(ctx context.Context) {
|
||||||
|
e2eskipper.SkipUnlessFeatureGateEnabled(features.RecursiveReadOnlyMounts)
|
||||||
ginkgo.By("waiting for the node to be ready", func() {
|
ginkgo.By("waiting for the node to be ready", func() {
|
||||||
waitForNodeReady(ctx)
|
waitForNodeReady(ctx)
|
||||||
if supportsRRO(ctx, f) {
|
if supportsRRO(ctx, f) {
|
||||||
@ -175,6 +172,7 @@ var _ = SIGDescribe("Mount recursive read-only [LinuxOnly]", framework.WithSeria
|
|||||||
}) // By
|
}) // By
|
||||||
}) // It
|
}) // It
|
||||||
f.It("should reject recursive read-only mounts", func(ctx context.Context) {
|
f.It("should reject recursive read-only mounts", func(ctx context.Context) {
|
||||||
|
e2eskipper.SkipUnlessFeatureGateEnabled(features.RecursiveReadOnlyMounts)
|
||||||
ginkgo.By("waiting for the node to be ready", func() {
|
ginkgo.By("waiting for the node to be ready", func() {
|
||||||
waitForNodeReady(ctx)
|
waitForNodeReady(ctx)
|
||||||
if supportsRRO(ctx, f) {
|
if supportsRRO(ctx, f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user