mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +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)
|
ch <- testSearchInternal(st, tr, mrs, accountsCount)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
var firstError error
|
||||||
for i := 0; i < cap(ch); i++ {
|
for i := 0; i < cap(ch); i++ {
|
||||||
select {
|
select {
|
||||||
case err := <-ch:
|
case err := <-ch:
|
||||||
if err != nil {
|
if err != nil && firstError == nil {
|
||||||
t.Fatalf("unexpected error: %s", err)
|
firstError = err
|
||||||
}
|
}
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
t.Fatalf("timeout")
|
t.Fatalf("timeout")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if firstError != nil {
|
||||||
|
t.Fatalf("unexpected error: %s", firstError)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user