From 9c1fb1da2f6fc18741acaa0f6f6f0184eb164699 Mon Sep 17 00:00:00 2001 From: weizhichen Date: Thu, 30 Mar 2023 06:49:52 +0000 Subject: [PATCH] fix defer cleanup order --- .../dynamically_provisioned_restart_driver_tester.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/e2e/testsuites/dynamically_provisioned_restart_driver_tester.go b/test/e2e/testsuites/dynamically_provisioned_restart_driver_tester.go index 84a3fd593..251f0cb59 100644 --- a/test/e2e/testsuites/dynamically_provisioned_restart_driver_tester.go +++ b/test/e2e/testsuites/dynamically_provisioned_restart_driver_tester.go @@ -47,11 +47,9 @@ func (t *DynamicallyProvisionedRestartDriverTest) Run(client clientset.Interface tDeployment, cleanup, _ := t.Pod.SetupDeployment(client, namespace, t.CSIDriver, t.StorageClassParameters) // defer must be called here for resources not get removed before using them - defer func() { - for i := range cleanup { - cleanup[i]() - } - }() + for i := range cleanup { + defer cleanup[i]() + } ginkgo.By("creating the deployment for the pod") tDeployment.Create()