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.
pull/12876/head
Bryan Boreham 2 years ago committed by GitHub
commit d498bb0d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tsdb/querier_test.go

@ -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)

Loading…
Cancel
Save