Skip to content

Commit

Permalink
Merge pull request #16549 from fuweid/deflake-test-TestHashKVWhenComp…
Browse files Browse the repository at this point in the history
…acting

server/storage/mvcc: deflake TestHashKVWhenCompacting
  • Loading branch information
ahrtr authored Sep 6, 2023
2 parents 70fd494 + a6f7bbe commit e5638d9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions server/storage/mvcc/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
}
}()
Expand Down

0 comments on commit e5638d9

Please sign in to comment.