Merge pull request #8206 from kaovilai/pkgpodvolumebackupper_test.go59714thecancelfunctionreturnedbycontext.WithTimeout

pkg/podvolume/backupper_test.go:597:14: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak
pull/8208/head
Wenkai Yin(尹文开) 2024-09-12 10:43:02 +08:00 committed by GitHub
commit 7e8a3c0bbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -594,7 +594,10 @@ func (l *logHook) Fire(entry *logrus.Entry) error {
}
func TestWaitAllPodVolumesProcessed(t *testing.T) {
timeoutCtx, _ := context.WithTimeout(context.Background(), 1*time.Second)
timeoutCtx, cancelFunc := context.WithTimeout(context.Background(), 1*time.Second)
defer func() {
cancelFunc()
}()
cases := []struct {
name string
ctx context.Context