mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
lib/storage: wait for all the goroutines to finish in TestSearch in order to prevent racy behavior on test finish
This commit is contained in:
parent
67e331ac62
commit
2cf2e9955b
@ -168,16 +168,20 @@ func testSearchGeneric(t *testing.T, forcePerDayInvertedIndex bool) {
|
||||
ch <- testSearchInternal(st, tr, mrs, accountsCount)
|
||||
}()
|
||||
}
|
||||
var firstError error
|
||||
for i := 0; i < cap(ch); i++ {
|
||||
select {
|
||||
case err := <-ch:
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
if err != nil && firstError == nil {
|
||||
firstError = err
|
||||
}
|
||||
case <-time.After(10 * time.Second):
|
||||
t.Fatalf("timeout")
|
||||
}
|
||||
}
|
||||
if firstError != nil {
|
||||
t.Fatalf("unexpected error: %s", firstError)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user