@@ -335,7 +335,7 @@ func DeleteAndWaitSnapshot(dc dynamic.Interface, ns string, snapshotName string,
335
335
var err error
336
336
ginkgo .By ("deleting the snapshot" )
337
337
err = dc .Resource (SnapshotGVR ).Namespace (ns ).Delete (context .TODO (), snapshotName , metav1.DeleteOptions {})
338
- if err != nil {
338
+ if err != nil && ! apierrors . IsNotFound ( err ) {
339
339
return err
340
340
}
341
341
@@ -427,13 +427,19 @@ func CreateSnapshotResource(sDriver SnapshottableTestDriver, config *PerTestConf
427
427
// We exploit this to create a snapshot resource from which we can create a preprovisioned snapshot
428
428
ginkgo .By ("deleting the snapshot and snapshot content" )
429
429
err = dc .Resource (SnapshotGVR ).Namespace (r .Vs .GetNamespace ()).Delete (context .TODO (), r .Vs .GetName (), metav1.DeleteOptions {})
430
+ if apierrors .IsNotFound (err ) {
431
+ err = nil
432
+ }
430
433
framework .ExpectNoError (err )
431
434
432
435
ginkgo .By ("checking the Snapshot has been deleted" )
433
436
err = utils .WaitForNamespacedGVRDeletion (dc , SnapshotGVR , r .Vs .GetName (), r .Vs .GetNamespace (), framework .Poll , framework .SnapshotDeleteTimeout )
434
437
framework .ExpectNoError (err )
435
438
436
439
err = dc .Resource (SnapshotContentGVR ).Delete (context .TODO (), r .Vscontent .GetName (), metav1.DeleteOptions {})
440
+ if apierrors .IsNotFound (err ) {
441
+ err = nil
442
+ }
437
443
framework .ExpectNoError (err )
438
444
439
445
ginkgo .By ("checking the Snapshot content has been deleted" )
@@ -498,13 +504,22 @@ func (sr *SnapshotResource) CleanupResource() error {
498
504
framework .ExpectNoError (err )
499
505
}
500
506
err = dc .Resource (SnapshotGVR ).Namespace (sr .Vs .GetNamespace ()).Delete (context .TODO (), sr .Vs .GetName (), metav1.DeleteOptions {})
507
+ if apierrors .IsNotFound (err ) {
508
+ err = nil
509
+ }
501
510
framework .ExpectNoError (err )
511
+
502
512
err = utils .WaitForGVRDeletion (dc , SnapshotContentGVR , boundVsContent .GetName (), framework .Poll , framework .SnapshotDeleteTimeout )
503
513
framework .ExpectNoError (err )
514
+
504
515
case apierrors .IsNotFound (err ):
505
516
// the volume snapshot is not bound to snapshot content yet
506
517
err = dc .Resource (SnapshotGVR ).Namespace (sr .Vs .GetNamespace ()).Delete (context .TODO (), sr .Vs .GetName (), metav1.DeleteOptions {})
518
+ if apierrors .IsNotFound (err ) {
519
+ err = nil
520
+ }
507
521
framework .ExpectNoError (err )
522
+
508
523
err = utils .WaitForNamespacedGVRDeletion (dc , SnapshotGVR , sr .Vs .GetName (), sr .Vs .GetNamespace (), framework .Poll , framework .SnapshotDeleteTimeout )
509
524
framework .ExpectNoError (err )
510
525
default :
@@ -531,6 +546,9 @@ func (sr *SnapshotResource) CleanupResource() error {
531
546
framework .ExpectNoError (err )
532
547
}
533
548
err = dc .Resource (SnapshotContentGVR ).Delete (context .TODO (), sr .Vscontent .GetName (), metav1.DeleteOptions {})
549
+ if apierrors .IsNotFound (err ) {
550
+ err = nil
551
+ }
534
552
framework .ExpectNoError (err )
535
553
536
554
err = utils .WaitForGVRDeletion (dc , SnapshotContentGVR , sr .Vscontent .GetName (), framework .Poll , framework .SnapshotDeleteTimeout )
0 commit comments