e2e/storage: update block device test to always specify a valid path

in the isEphemeral case, the pvcBlock doesn't have a filled in name, which means the DevicePath is "/mnt".

When using the OCI runtime runc, this is valid because runc sanitizes the path, mounting it in `/mnt` in the container.
However, the OCI runtime crun does not do this.

One can argue the validity of passing a path structured like a directory as a block device, but ultimately from what I can see
this wasn't intentional.

As such, fix it by setting the mount to be based on the first Volume name, which both cases should have filled out.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
Peter Hunt 2024-08-12 12:36:09 -04:00
parent 60c4c2b252
commit 41e6162cc0

View File

@ -285,7 +285,7 @@ var _ = utils.SIGDescribe(framework.WithSerial(), "Volume metrics", func() {
pod := makePod(f, pvcBlock, isEphemeral)
pod.Spec.Containers[0].VolumeDevices = []v1.VolumeDevice{{
Name: pod.Spec.Volumes[0].Name,
DevicePath: "/mnt/" + pvcBlock.Name,
DevicePath: "/mnt/" + pod.Spec.Volumes[0].Name,
}}
pod.Spec.Containers[0].VolumeMounts = nil
pod, err = c.CoreV1().Pods(ns).Create(ctx, pod, metav1.CreateOptions{})