Skip to content

Commit

Permalink
Fix TestMinResolvedTS
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Jun 16, 2022
1 parent 596c20d commit 9a00bca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/server/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,12 +1332,14 @@ func TestMinResolvedTS(t *testing.T) {
// case2: add leader peer to store1 but no run job
// min resolved ts should be zero
putRegionWithLeader(re, rc, id, store1)
time.Sleep(time.Millisecond)
ts := rc.GetMinResolvedTS()
re.Equal(uint64(0), ts)

// case3: add leader peer to store1 and run job
// min resolved ts should be store1TS
setMinResolvedTSPersistenceInterval(re, rc, svr, time.Millisecond)
time.Sleep(time.Millisecond)
ts = rc.GetMinResolvedTS()
re.Equal(store1TS, ts)
checkMinResolvedTSFromStorage(re, rc, ts)
Expand All @@ -1355,6 +1357,7 @@ func TestMinResolvedTS(t *testing.T) {
// case6: set store1 to tombstone
// min resolved ts should change to store 3
resetStoreState(re, rc, store1, metapb.StoreState_Tombstone)
time.Sleep(time.Millisecond)
ts = rc.GetMinResolvedTS()
re.Equal(store3TS, ts)

Expand All @@ -1363,6 +1366,7 @@ func TestMinResolvedTS(t *testing.T) {
checkMinResolvedTSFromStorage(re, rc, store3TS)
store4 := addStoreAndCheckMinResolvedTS(re, false /* not tiflash */, 0, store3TS)
putRegionWithLeader(re, rc, id, store4)
time.Sleep(time.Millisecond)
ts = rc.GetMinResolvedTS()
re.Equal(store3TS, ts)
checkMinResolvedTSFromStorage(re, rc, store3TS)
Expand All @@ -1375,9 +1379,11 @@ func TestMinResolvedTS(t *testing.T) {
store5 := addStoreAndCheckMinResolvedTS(re, false /* not tiflash */, store5TS, store3TS)
resetStoreState(re, rc, store3, metapb.StoreState_Tombstone)
putRegionWithLeader(re, rc, id, store5)
time.Sleep(time.Millisecond)
ts = rc.GetMinResolvedTS()
re.Equal(store3TS, ts)
setMinResolvedTSPersistenceInterval(re, rc, svr, time.Millisecond)
time.Sleep(time.Millisecond)
ts = rc.GetMinResolvedTS()
re.Equal(store5TS, ts)
}
Expand Down

0 comments on commit 9a00bca

Please sign in to comment.