Skip to content

Commit

Permalink
Refine test
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Shi <[email protected]>
  • Loading branch information
binshi-bing committed May 11, 2023
1 parent ba92fb3 commit 7655c80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 0 additions & 2 deletions pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,6 @@ func (kgm *KeyspaceGroupManager) GetMinTS(
return pdpb.Timestamp{}, kgAskedCount, kgTotalCount, nil
}

log.Info("get min ts!!!!!!!!!!!!!!!!!!!!", zap.String("dc-location", dcLocation), zap.Int64("min-ts-physical", minTS.Physical), zap.Int64("min-ts-logical", minTS.Logical))

return *minTS, kgAskedCount, kgTotalCount, nil
}

Expand Down
18 changes: 14 additions & 4 deletions tests/integrations/tso/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,23 @@ func (suite *tsoClientTestSuite) TestGetMinTS() {
for _, client := range suite.clients {
go func(client pd.Client) {
defer wg.Done()
var lastTS uint64
var lastMinTS uint64
for j := 0; j < tsoRequestRound; j++ {
physical, logical, err := client.GetMinTS(suite.ctx)
suite.NoError(err)
ts := tsoutil.ComposeTS(physical, logical)
suite.Less(lastTS, ts)
lastTS = ts
minTS := tsoutil.ComposeTS(physical, logical)
suite.Less(lastMinTS, minTS)
lastMinTS = minTS

// Now we check whether the returned ts is the minimum one
// among all keyspace groups, i.e., the returned ts is
// less than the new timestamps of all keyspace groups.
for _, client := range suite.clients {
physical, logical, err := client.GetTS(suite.ctx)
suite.NoError(err)
ts := tsoutil.ComposeTS(physical, logical)
suite.Less(minTS, ts)
}
}
}(client)
}
Expand Down

0 comments on commit 7655c80

Please sign in to comment.