Skip to content

Commit

Permalink
tests: group invalid configuration tests in a new context
Browse files Browse the repository at this point in the history
Signed-off-by: Raghavendra Talur <[email protected]>
  • Loading branch information
raghavendra-talur committed Sep 6, 2024
1 parent 6f4d9f3 commit 032c705
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/controller/vrg_volrep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ var _ = Describe("VolumeReplicationGroupVolRepController", func() {
vtest.promoteVolReps()
vtest.waitForVRGStateToTransitionToPrimary()
cleanupS3Store()
vtest.forEachPVC(func(pvc corev1.PersistentVolumeClaim) {
pvcDelete(pvc)
})
})
})

Expand All @@ -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()
})
Expand Down Expand Up @@ -1905,7 +1910,7 @@ func (v *vrgTest) cleanupPVCs(
}

v.forEachPVC(func(pvc corev1.PersistentVolumeClaim) {
pvcDelete(*vrg, pvc, pvcPreDeleteVerify, pvcPostDeleteVerify1)
pvcDeleteWithVerify(*vrg, pvc, pvcPreDeleteVerify, pvcPostDeleteVerify1)
})
}

Expand All @@ -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,
Expand Down

0 comments on commit 032c705

Please sign in to comment.