From 01a01e2ac4e82501cb9baef24a64bf1769d0b263 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Tue, 26 May 2026 17:57:16 -0400 Subject: [PATCH] Add additional check for restore pvc.Capacity from pv annotation --- test/e2e/storage/csimock/csi_volume_expansion.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/e2e/storage/csimock/csi_volume_expansion.go b/test/e2e/storage/csimock/csi_volume_expansion.go index f182e427586..4c49aa9804c 100644 --- a/test/e2e/storage/csimock/csi_volume_expansion.go +++ b/test/e2e/storage/csimock/csi_volume_expansion.go @@ -705,6 +705,17 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { _, err = e2epv.WaitForPVClaimBoundPhase(ctx, m.cs, []*v1.PersistentVolumeClaim{reboundPVC}, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "while waiting for new PVC to be bound") + ginkgo.By("Verifying PVC status.capacity reflects pre-resize capacity from PV annotation") + originalSize := resource.MustParse("1Gi") + gomega.Eventually(func(g gomega.Gomega) { + reboundPVC, err = m.cs.CoreV1().PersistentVolumeClaims(reboundPVC.Namespace).Get(ctx, reboundPVC.Name, metav1.GetOptions{}) + g.Expect(err).NotTo(gomega.HaveOccurred()) + pvcStatusCap := reboundPVC.Status.Capacity[v1.ResourceStorage] + g.Expect(pvcStatusCap.Cmp(originalSize)).To(gomega.Equal(0), + fmt.Sprintf("expected PVC status.capacity to be %s (from pre-resize annotation), got %s", originalSize.String(), pvcStatusCap.String())) + }).WithTimeout(csiResizeWaitPeriod).WithPolling(resizePollInterval). + Should(gomega.Succeed(), "PV controller should set PVC status.capacity from pre-resize-capacity annotation") + ginkgo.By("Creating a new pod with the rebound PVC") pod2, err := m.createPodWithPVC(reboundPVC) gomega.Expect(pod2).NotTo(gomega.BeNil(), "while creating pod for resizing")