diff --git a/server/storage/mvcc/kvstore_test.go b/server/storage/mvcc/kvstore_test.go index af4c3846c33..1e57c59f357 100644 --- a/server/storage/mvcc/kvstore_test.go +++ b/server/storage/mvcc/kvstore_test.go @@ -591,18 +591,17 @@ func TestHashKVWhenCompacting(t *testing.T) { defer wg.Done() revHash := make(map[int64]uint32) for { - r := <-hashCompactc - if revHash[r.compactRev] == 0 { - revHash[r.compactRev] = r.hash - } - if r.hash != revHash[r.compactRev] { - t.Errorf("Hashes differ (current %v) != (saved %v)", r.hash, revHash[r.compactRev]) - } - select { + case r := <-hashCompactc: + if revHash[r.compactRev] == 0 { + revHash[r.compactRev] = r.hash + } + + if r.hash != revHash[r.compactRev] { + t.Errorf("Hashes differ (current %v) != (saved %v)", r.hash, revHash[r.compactRev]) + } case <-donec: return - default: } } }()