Merge pull request #100549 from RaunakShah/fix_snapshot_cleanup

Fix check before deleting PV in Snapshot e2e test
This commit is contained in:
Kubernetes Prow Robot 2021-03-24 21:41:29 -07:00 committed by GitHub
commit 533931cfe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1347,7 +1347,10 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
framework.Failf("Expected deletion timestamp to be set on snapshotcontent")
}
if claim != nil {
// If the claim is non existent, the Get() call on the API server returns
// an non-nil claim object with all fields unset.
// Refer https://github.com/kubernetes/kubernetes/pull/99167#issuecomment-781670012
if claim != nil && claim.Spec.VolumeName != "" {
ginkgo.By(fmt.Sprintf("Wait for PV %s to be deleted", claim.Spec.VolumeName))
err = e2epv.WaitForPersistentVolumeDeleted(m.cs, claim.Spec.VolumeName, framework.Poll, 3*time.Minute)
framework.ExpectNoError(err, fmt.Sprintf("failed to delete PV %s", claim.Spec.VolumeName))