storage: Remove race condition from TestLoop

This commit is contained in:
beorn7 2017-02-01 19:41:15 +01:00
parent 34767c2221
commit 752fac60ae

View file

@ -840,10 +840,15 @@ func TestLoop(t *testing.T) {
storage.Append(s)
}
storage.WaitForIndexing()
series, _ := storage.fpToSeries.get(model.Metric{}.FastFingerprint())
fp := model.Metric{}.FastFingerprint()
series, _ := storage.fpToSeries.get(fp)
storage.fpLocker.Lock(fp)
cdsBefore := len(series.chunkDescs)
storage.fpLocker.Unlock(fp)
time.Sleep(fpMaxWaitDuration + time.Second) // TODO(beorn7): Ugh, need to wait for maintenance to kick in.
storage.fpLocker.Lock(fp)
cdsAfter := len(series.chunkDescs)
storage.fpLocker.Unlock(fp)
storage.Stop()
if cdsBefore <= cdsAfter {
t.Errorf(