From 752fac60ae4a07e742dd5908120d8bc3b9fe656b Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 1 Feb 2017 19:41:15 +0100 Subject: [PATCH] storage: Remove race condition from TestLoop --- storage/local/storage_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go index d63b6d3ab..591e3df37 100644 --- a/storage/local/storage_test.go +++ b/storage/local/storage_test.go @@ -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(