Skip to content

Commit

Permalink
fix defer cleanup order
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvz committed Mar 30, 2023
1 parent b4d44b2 commit 9c1fb1d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9c1fb1d

Please sign in to comment.