From 2a142a04066f1c068ef31fe0f08b1a9fe2b5c905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Fri, 19 Jul 2024 18:41:10 +0200 Subject: [PATCH] [CONTINT-4278] Fix a race condition in `pkg/sbom/scanner/TestRetryLogic_Error` (#27748) --- pkg/sbom/scanner/scanner_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sbom/scanner/scanner_test.go b/pkg/sbom/scanner/scanner_test.go index 9d406707ed89c..52c384a283d11 100644 --- a/pkg/sbom/scanner/scanner_test.go +++ b/pkg/sbom/scanner/scanner_test.go @@ -117,6 +117,7 @@ func TestRetryLogic_Error(t *testing.T) { mockCollector.On("Scan", mock.Anything, mock.Anything).Return(expectedResult).Once() mockCollector.On("Channel").Return(resultCh) shutdown := mockCollector.On("Shutdown") + shutdown.After(5 * time.Second) mockCollector.On("Type").Return(tt.st) // Set up the configuration as the default one is too slow @@ -150,7 +151,6 @@ func TestRetryLogic_Error(t *testing.T) { case <-time.After(time.Second): } cancel() - shutdown.WaitUntil(time.After(5 * time.Second)) }) } }