e2e_node: mount_rro: fix error string comparison

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2024-03-11 11:26:40 +09:00
parent 5cc1e56248
commit ea14ccdf13
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A

View File

@ -123,13 +123,8 @@ var _ = SIGDescribe("Mount recursive read-only [LinuxOnly]", framework.WithSeria
},
},
}
pod = e2epod.NewPodClient(f).Create(ctx, pod)
framework.ExpectNoError(e2epod.WaitForPodContainerToFail(ctx, f.ClientSet, pod.Namespace, pod.Name, 0, "CreateContainerConfigError", framework.PodStartShortTimeout))
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"))
_, err := f.ClientSet.CoreV1().Pods(pod.Namespace).Create(ctx, pod, metav1.CreateOptions{})
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("spec.containers[0].volumeMounts.recursiveReadOnly: Forbidden: may only be specified when readOnly is true")))
}) // By
// See also the unit test [pkg/kubelet.TestResolveRecursiveReadOnly] for more invalid conditions (e.g., incompatible mount propagation)
}) // It