Merge pull request #12875 from dimitarvdimitrov/dimitar/TestQuerierIndexQueriesRace-incorrect-exit-condition

Fix samples generation in TestQuerierIndexQueriesRace

The loop would run forever if the context was cancelled before the goroutine got started.
This commit is contained in:
Bryan Boreham 2023-09-20 20:20:30 +00:00 committed by GitHub
commit d498bb0d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2252,7 +2252,7 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
func appendSeries(t *testing.T, ctx context.Context, wg *sync.WaitGroup, h *Head) {
defer wg.Done()
for i := 0; ctx.Err() != nil; i++ {
for i := 0; ctx.Err() == nil; i++ {
app := h.Appender(context.Background())
_, err := app.Append(0, labels.FromStrings(labels.MetricName, "metric", "seq", strconv.Itoa(i), "always_0", "0"), 0, 0)
require.NoError(t, err)