From 7655c800d8d6f643bb63d24acf5c983a9f866fc9 Mon Sep 17 00:00:00 2001 From: Bin Shi Date: Thu, 11 May 2023 07:56:31 +0800 Subject: [PATCH] Refine test Signed-off-by: Bin Shi --- pkg/tso/keyspace_group_manager.go | 2 -- tests/integrations/tso/client_test.go | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pkg/tso/keyspace_group_manager.go b/pkg/tso/keyspace_group_manager.go index 3fa81211ad74..7038ef8e373a 100644 --- a/pkg/tso/keyspace_group_manager.go +++ b/pkg/tso/keyspace_group_manager.go @@ -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 } diff --git a/tests/integrations/tso/client_test.go b/tests/integrations/tso/client_test.go index 06b2ef9c7510..96365deb4865 100644 --- a/tests/integrations/tso/client_test.go +++ b/tests/integrations/tso/client_test.go @@ -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) }