Skip to content

Commit

Permalink
Merge branch 'master' into fix-watch
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Apr 17, 2023
2 parents c5c6b5d + 8c9b4fb commit 596d6e4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/server/tso/global_tso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestLogicalOverflow(t *testing.T) {
defer tsoClient.CloseSend()

begin := time.Now()
for i := 0; i < 2; i += 1 { // the 2nd request may (but not must) overflow, as max logical interval is 262144
for i := 0; i < 3; i++ {
req := &pdpb.TsoRequest{
Header: testutil.NewRequestHeader(clusterID),
Count: 150000,
Expand All @@ -163,12 +163,13 @@ func TestLogicalOverflow(t *testing.T) {
re.NoError(tsoClient.Send(req))
_, err = tsoClient.Recv()
re.NoError(err)
if i == 1 {
// the 2nd request may (but not must) overflow, as max logical interval is 262144
re.Less(time.Since(begin), updateInterval+20*time.Millisecond) // additional 20ms for gRPC latency
}
}
elapse := time.Since(begin)
if updateInterval >= 20*time.Millisecond { // on small interval, the physical may update before overflow
re.GreaterOrEqual(elapse, updateInterval)
}
re.Less(elapse, updateInterval+20*time.Millisecond) // additional 20ms for gRPC latency
// the 3rd request must overflow
re.GreaterOrEqual(time.Since(begin), updateInterval)
}

for _, updateInterval := range []int{1, 5, 30, 50} {
Expand Down

0 comments on commit 596d6e4

Please sign in to comment.