Skip to content

Commit

Permalink
Add more test to verify primary path is used correctly
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 29, 2023
1 parent af9bd00 commit f5952ef
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/integrations/mcs/tso/keyspace_group_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,24 @@ func (suite *tsoKeyspaceGroupManagerTestSuite) TestKeyspacesServedByNonDefaultKe
re.NotNil(am)

// Make sure every keyspace group is using the right timestamp path
// for loading/saving timestamp from/to etcd.
var timestampPath string
// for loading/saving timestamp from/to etcd and the right primary path
// for leader election.
var (
timestampPath string
primaryPath string
)
clusterID := strconv.FormatUint(suite.pdLeaderServer.GetClusterID(), 10)
if param.keyspaceGroupID == mcsutils.DefaultKeyspaceGroupID {
timestampPath = fmt.Sprintf("/pd/%s/timestamp", clusterID)
primaryPath = fmt.Sprintf("/ms/%s/tso/00000/primary", clusterID)
} else {
timestampPath = fmt.Sprintf("/ms/%s/tso/%05d/gta/timestamp",
clusterID, param.keyspaceGroupID)
primaryPath = fmt.Sprintf("/ms/%s/tso/%s/election/%05d/primary",
clusterID, mcsutils.KeyspaceGroupsKey, param.keyspaceGroupID)
}
re.Equal(timestampPath, am.GetTimestampPath(""))
re.Equal(timestampPath, am.GetTimestampPath(tsopkg.GlobalDCLocation))
re.Equal(primaryPath, am.GetMember().GetLeaderPath())

served = true
}
Expand Down

0 comments on commit f5952ef

Please sign in to comment.