diff --git a/internal/controller/vrg_volrep_test.go b/internal/controller/vrg_volrep_test.go index 73e4e3e20..bcc55b243 100644 --- a/internal/controller/vrg_volrep_test.go +++ b/internal/controller/vrg_volrep_test.go @@ -241,6 +241,9 @@ var _ = Describe("VolumeReplicationGroupVolRepController", func() { vtest.promoteVolReps() vtest.waitForVRGStateToTransitionToPrimary() cleanupS3Store() + vtest.forEachPVC(func(pvc corev1.PersistentVolumeClaim) { + pvcDelete(pvc) + }) }) }) @@ -263,6 +266,8 @@ var _ = Describe("VolumeReplicationGroupVolRepController", func() { numPVs := pvcCount vrgTestBoundPV = newVRGTestCaseCreate(numPVs, restoreTestTemplate, true, false) pvList := vrgTestBoundPV.generateFakePVs("pv", numPVs) + pvcList := vrgTestBoundPV.generateFakePVCs(pvList) + updatePVCClaimBindInfo(pvcList, corev1.ClaimBound) populateS3Store(vrgTestBoundPV.s3KeyPrefix(), pvList, []corev1.PersistentVolumeClaim{}) vrgTestBoundPV.VRGTestCaseStart() }) @@ -1905,7 +1910,7 @@ func (v *vrgTest) cleanupPVCs( } v.forEachPVC(func(pvc corev1.PersistentVolumeClaim) { - pvcDelete(*vrg, pvc, pvcPreDeleteVerify, pvcPostDeleteVerify1) + pvcDeleteWithVerify(*vrg, pvc, pvcPreDeleteVerify, pvcPostDeleteVerify1) }) } @@ -1920,7 +1925,13 @@ func forPVCs(pvcNames []types.NamespacedName, do func(pvc corev1.PersistentVolum } } -func pvcDelete( +func pvcDelete(pvc corev1.PersistentVolumeClaim) { + pvcNamespacedName := client.ObjectKeyFromObject(&pvc) + + Expect(k8sClient.Delete(context.TODO(), &pvc)).To(BeNil(), "failed to delete PVC %s", pvcNamespacedName) +} + +func pvcDeleteWithVerify( vrg ramendrv1alpha1.VolumeReplicationGroup, pvc corev1.PersistentVolumeClaim, preDeleteVerify pvcPreDeleteVerify,