mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Fix race in test
Signed-off-by: Alex Greenbank <alex.greenbank@grafana.com>
This commit is contained in:
parent
766d947ba5
commit
b884b15f39
|
@ -179,12 +179,17 @@ func TestContentNegotiation(t *testing.T) {
|
||||||
c.expectSamples(samples, series)
|
c.expectSamples(samples, series)
|
||||||
}
|
}
|
||||||
qm.Append(samples)
|
qm.Append(samples)
|
||||||
|
|
||||||
if !tc.success {
|
if !tc.success {
|
||||||
// We just need to sleep for a bit to give it time to run
|
// We just need to sleep for a bit to give it time to run
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
|
// But we still need to check for data with no delay to avoid race
|
||||||
|
c.waitForExpectedData(t, 0*time.Second)
|
||||||
} else {
|
} else {
|
||||||
c.waitForExpectedData(t, 2*time.Second)
|
// We expected data so wait for it
|
||||||
|
c.waitForExpectedData(t, 5*time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
require.Equal(t, len(c.sendAttempts), len(tc.steps))
|
require.Equal(t, len(c.sendAttempts), len(tc.steps))
|
||||||
for i, s := range c.sendAttempts {
|
for i, s := range c.sendAttempts {
|
||||||
require.Equal(t, s, tc.steps[i].attemptString)
|
require.Equal(t, s, tc.steps[i].attemptString)
|
||||||
|
|
Loading…
Reference in a new issue