storage e2e: fix volume metric test for PVC

The fix for the ephemeral volume
case (7538d089d5) broke the other variant with
PVC because pvc.Name is only set *after* creating the PVC.
This commit is contained in:
Patrick Ohly 2021-10-21 17:09:49 +02:00
parent c0bdf14942
commit d6aa7e321f

View File

@ -213,7 +213,6 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() {
}
filesystemMode := func(isEphemeral bool) {
pvcName := pvc.Name
if !isEphemeral {
pvc, err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(context.TODO(), pvc, metav1.CreateOptions{})
framework.ExpectNoError(err)
@ -230,6 +229,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() {
pod, err = c.CoreV1().Pods(ns).Get(context.TODO(), pod.Name, metav1.GetOptions{})
framework.ExpectNoError(err)
pvcName := pvc.Name
if isEphemeral {
pvcName = ephemeral.VolumeClaimName(pod, &pod.Spec.Volumes[0])
}