From d6aa7e321fd65012ee49499b94727b11c4cc10a9 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 21 Oct 2021 17:09:49 +0200 Subject: [PATCH] storage e2e: fix volume metric test for PVC The fix for the ephemeral volume case (7538d089d5cb5305c3558bb9614ae82bdad7bc2b) broke the other variant with PVC because pvc.Name is only set *after* creating the PVC. --- test/e2e/storage/volume_metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/storage/volume_metrics.go b/test/e2e/storage/volume_metrics.go index 9e2c7b3d93a..658f9421b0a 100644 --- a/test/e2e/storage/volume_metrics.go +++ b/test/e2e/storage/volume_metrics.go @@ -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]) }