Skip to content

Commit

Permalink
tests: fix waitFinishMerge to stablize the merge test (#7052)
Browse files Browse the repository at this point in the history
close #7051

Make `waitFinishMerge` assert the keyspace list after the merge is finished rather than every time.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato authored Sep 6, 2023
1 parent a83322f commit 41eae1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions tests/integrations/mcs/tso/keyspace_group_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,14 +648,16 @@ func waitFinishMerge(
mergeTargetID uint32,
keyspaces []uint32,
) {
var kg *endpoint.KeyspaceGroup
testutil.Eventually(re, func() bool {
kg := handlersutil.MustLoadKeyspaceGroupByID(re, server, mergeTargetID)
re.Equal(mcsutils.DefaultKeyspaceGroupID, kg.ID)
for _, keyspaceID := range keyspaces {
re.Contains(kg.Keyspaces, keyspaceID)
}
kg = handlersutil.MustLoadKeyspaceGroupByID(re, server, mergeTargetID)
re.Equal(mergeTargetID, kg.ID)
return !kg.IsMergeTarget()
})
// If the merge is finished, the target keyspace group should contain all the keyspaces.
for _, keyspaceID := range keyspaces {
re.Contains(kg.Keyspaces, keyspaceID)
}
}

func (suite *tsoKeyspaceGroupManagerTestSuite) TestTSOKeyspaceGroupMergeBeforeInitTSO() {
Expand Down
1 change: 0 additions & 1 deletion tests/integrations/mcs/tso/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ func (s *tsoProxyTestSuite) verifyTSOProxy(
for j := 0; j < requestsPerClient; j++ {
select {
case <-ctx.Done():
respErr.Store(ctx.Err())
s.cleanupGRPCStream(streams, cleanupFuncs, i)
return
default:
Expand Down

0 comments on commit 41eae1a

Please sign in to comment.