mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
use Cleanup instead of defer
This commit is contained in:
parent
41577dea1b
commit
8e4b00e949
@ -1515,9 +1515,11 @@ func runWorkload(tCtx ktesting.TContext, tc *testCase, w *workload, informerFact
|
||||
workload: w,
|
||||
}
|
||||
|
||||
defer executor.wg.Wait()
|
||||
defer executor.collectorWG.Wait()
|
||||
defer tCtx.Cancel("workload is done")
|
||||
tCtx.TB().Cleanup(func() {
|
||||
tCtx.Cancel("workload is done")
|
||||
executor.collectorWG.Wait()
|
||||
executor.wg.Wait()
|
||||
})
|
||||
|
||||
for opIndex, op := range unrollWorkloadTemplate(tCtx, tc.WorkloadTemplate, w) {
|
||||
realOp, err := op.realOp.patchParams(w)
|
||||
|
Loading…
Reference in New Issue
Block a user