@@ -213,14 +213,14 @@ func (h *hostpathCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.Per
213
213
ginkgo .By (fmt .Sprintf ("deleting the test namespace: %s" , ns1 ))
214
214
// Delete the primary namespace but its okay to fail here because this namespace will
215
215
// also be deleted by framework.Aftereach hook
216
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns1 , framework . DefaultNamespaceDeletionTimeout ) )
216
+ tryFunc (func () { f . DeleteNamespace ( ns1 ) } )
217
217
218
218
ginkgo .By ("uninstalling csi mock driver" )
219
219
tryFunc (cleanup )
220
220
tryFunc (cancelLogging )
221
221
222
222
ginkgo .By (fmt .Sprintf ("deleting the driver namespace: %s" , ns2 ))
223
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns2 , framework . DefaultNamespaceDeletionTimeout ) )
223
+ tryFunc (func () { f . DeleteNamespace ( ns2 ) } )
224
224
// cleanup function has already ran and hence we don't need to run it again.
225
225
// We do this as very last action because in-case defer(or AfterEach) races
226
226
// with AfterSuite and test routine gets killed then this block still
@@ -416,7 +416,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
416
416
ginkgo .By (fmt .Sprintf ("deleting the test namespace: %s" , ns1 ))
417
417
// Delete the primary namespace but its okay to fail here because this namespace will
418
418
// also be deleted by framework.Aftereach hook
419
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns1 , framework . DefaultNamespaceDeletionTimeout ) )
419
+ tryFunc (func () { f . DeleteNamespace ( ns1 ) } )
420
420
421
421
ginkgo .By ("uninstalling csi mock driver" )
422
422
tryFunc (func () {
@@ -429,7 +429,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
429
429
tryFunc (cleanup )
430
430
tryFunc (cancelLogging )
431
431
ginkgo .By (fmt .Sprintf ("deleting the driver namespace: %s" , ns2 ))
432
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns2 , framework . DefaultNamespaceDeletionTimeout ) )
432
+ tryFunc (func () { f . DeleteNamespace ( ns2 ) } )
433
433
// cleanup function has already ran and hence we don't need to run it again.
434
434
// We do this as very last action because in-case defer(or AfterEach) races
435
435
// with AfterSuite and test routine gets killed then this block still
@@ -577,14 +577,14 @@ func (g *gcePDCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTes
577
577
ginkgo .By (fmt .Sprintf ("deleting the test namespace: %s" , ns1 ))
578
578
// Delete the primary namespace but its okay to fail here because this namespace will
579
579
// also be deleted by framework.Aftereach hook
580
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns1 , framework . DefaultNamespaceDeletionTimeout ) )
580
+ tryFunc (func () { f . DeleteNamespace ( ns1 ) } )
581
581
582
582
ginkgo .By ("uninstalling csi mock driver" )
583
583
tryFunc (cleanup )
584
584
tryFunc (cancelLogging )
585
585
586
586
ginkgo .By (fmt .Sprintf ("deleting the driver namespace: %s" , ns2 ))
587
- tryFunc (deleteNamespaceFunc ( f . ClientSet , ns2 , framework . DefaultNamespaceDeletionTimeout ) )
587
+ tryFunc (func () { f . DeleteNamespace ( ns2 ) } )
588
588
// cleanup function has already ran and hence we don't need to run it again.
589
589
// We do this as very last action because in-case defer(or AfterEach) races
590
590
// with AfterSuite and test routine gets killed then this block still
@@ -646,19 +646,6 @@ func WaitForCSIDriverRegistrationOnNode(nodeName string, driverName string, cs c
646
646
return nil
647
647
}
648
648
649
- func deleteNamespaceFunc (cs clientset.Interface , ns string , timeout time.Duration ) func () {
650
- return func () {
651
- err := cs .CoreV1 ().Namespaces ().Delete (context .TODO (), ns , metav1.DeleteOptions {})
652
- if err != nil && ! apierrors .IsNotFound (err ) {
653
- framework .Logf ("error deleting namespace %s: %v" , ns , err )
654
- }
655
- err = framework .WaitForNamespacesDeleted (cs , []string {ns }, timeout )
656
- if err != nil {
657
- framework .Logf ("error deleting namespace %s: %v" , ns , err )
658
- }
659
- }
660
- }
661
-
662
649
func tryFunc (f func ()) error {
663
650
var err error
664
651
if f == nil {
0 commit comments