mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #12881 from dimitarvdimitrov/dimitar/TestQuerierIndexQueriesRace-less-synchronisation
Improve sensitivity of TestQuerierIndexQueriesRace
This commit is contained in:
commit
b80617a248
|
@ -2637,6 +2637,7 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
|
||||||
for _, c := range testCases {
|
for _, c := range testCases {
|
||||||
c := c
|
c := c
|
||||||
t.Run(fmt.Sprintf("%v", c.matchers), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%v", c.matchers), func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
db := openTestDB(t, DefaultOptions(), nil)
|
db := openTestDB(t, DefaultOptions(), nil)
|
||||||
h := db.Head()
|
h := db.Head()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
@ -2656,6 +2657,9 @@ func TestQuerierIndexQueriesRace(t *testing.T) {
|
||||||
values, _, err := q.LabelValues(ctx, "seq", c.matchers...)
|
values, _, err := q.LabelValues(ctx, "seq", c.matchers...)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Emptyf(t, values, `label values for label "seq" should be empty`)
|
require.Emptyf(t, values, `label values for label "seq" should be empty`)
|
||||||
|
|
||||||
|
// Sleep to give the appends some change to run.
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -2672,6 +2676,7 @@ func appendSeries(t *testing.T, ctx context.Context, wg *sync.WaitGroup, h *Head
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Throttle down the appends to keep the test somewhat nimble.
|
// Throttle down the appends to keep the test somewhat nimble.
|
||||||
|
// Otherwise, we end up appending thousands or millions of samples.
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue