Fix race in test.

Change-Id: I53e1a4c5a6b5f846acd76043166b6cb7bf7d5dc7
This commit is contained in:
Bjoern Rabenstein 2014-11-13 17:11:39 +01:00
parent d73e851b14
commit e23ee0f7cc
1 changed files with 2 additions and 0 deletions

View File

@ -72,6 +72,7 @@ func TestChunk(t *testing.T) {
s.AppendSamples(samples)
for m := range s.(*memorySeriesStorage).fpToSeries.iter() {
s.(*memorySeriesStorage).fpLocker.Lock(m.fp)
for i, v := range m.series.values() {
if samples[i].Timestamp != v.Timestamp {
t.Fatalf("%d. Got %v; want %v", i, v.Timestamp, samples[i].Timestamp)
@ -80,6 +81,7 @@ func TestChunk(t *testing.T) {
t.Fatalf("%d. Got %v; want %v", i, v.Value, samples[i].Value)
}
}
s.(*memorySeriesStorage).fpLocker.Unlock(m.fp)
}
}