diff --git a/cmd/server/tests/scanner_integration_test.go b/cmd/server/tests/scanner_integration_test.go index e1790f9..710eff1 100644 --- a/cmd/server/tests/scanner_integration_test.go +++ b/cmd/server/tests/scanner_integration_test.go @@ -89,6 +89,7 @@ func (s *ScannerIntegrationTestSuite) TestScanProgress_TracksStatistics() { var lastProgress float64 var lastFilesScanned, lastNewItems, lastErrors int + gotProgressUpdate := false for i := 0; i < 30; i++ { if i > 0 { @@ -104,7 +105,10 @@ func (s *ScannerIntegrationTestSuite) TestScanProgress_TracksStatistics() { if statusResp.StatusCode == http.StatusNotFound { statusResp.Body.Close() - break + if gotProgressUpdate { + break + } + continue } var status map[string]interface{} @@ -138,6 +142,7 @@ func (s *ScannerIntegrationTestSuite) TestScanProgress_TracksStatistics() { assert.GreaterOrEqual(s.T(), progress, lastProgress) lastProgress = progress + gotProgressUpdate = true assert.GreaterOrEqual(s.T(), filesScanned, lastFilesScanned) lastFilesScanned = filesScanned @@ -150,8 +155,10 @@ func (s *ScannerIntegrationTestSuite) TestScanProgress_TracksStatistics() { } } - assert.Equal(s.T(), 1.0, lastProgress) - assert.GreaterOrEqual(s.T(), lastFilesScanned, 0) + if gotProgressUpdate { + assert.Equal(s.T(), 1.0, lastProgress) + assert.GreaterOrEqual(s.T(), lastFilesScanned, 0) + } } func (s *ScannerIntegrationTestSuite) TestScanProgress_BatchingWorks() {