Documentation ¶
Index ¶
- func SetupClient(ctx context.Context, re *require.Assertions, endpoints []string, ...) tm.Client
- func SetupClientWithKeyspace(ctx context.Context, re *require.Assertions, endpoints []string, ...) tm.Client
- func StartSingleResourceManagerTestServer(ctx context.Context, re *require.Assertions, ...) (*rm.Server, func())
- func StartSingleTSOTestServer(ctx context.Context, re *require.Assertions, ...) (*tso.Server, func())
- func WaitForPrimaryServing(re *require.Assertions, serverMap map[string]bs.Server) string
- func WaitForTSOServiceAvailable(ctx context.Context, pdClient tm.Client) error
- type TestCluster
- func (tc *TestCluster) AddServer(addr string) error
- func (tc *TestCluster) Destroy()
- func (tc *TestCluster) DestroyServer(addr string)
- func (tc *TestCluster) GetPrimary(keyspaceID, keyspaceGroupID uint32) *tso.Server
- func (tc *TestCluster) GetServer(addr string) *tso.Server
- func (tc *TestCluster) GetServers() map[string]*tso.Server
- func (tc *TestCluster) WaitForDefaultPrimaryServing(re *require.Assertions) string
- func (tc *TestCluster) WaitForPrimaryServing(re *require.Assertions, keyspaceID, keyspaceGroupID uint32) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupClient ¶
func SetupClient(ctx context.Context, re *require.Assertions, endpoints []string, opts ...tm.ClientOption) tm.Client
SetupClient creates a TSO client for test.
func SetupClientWithKeyspace ¶
func SetupClientWithKeyspace(ctx context.Context, re *require.Assertions, endpoints []string, opts ...tm.ClientOption) tm.Client
SetupClientWithKeyspace creates a TSO client for test.
func StartSingleResourceManagerTestServer ¶
func StartSingleResourceManagerTestServer(ctx context.Context, re *require.Assertions, backendEndpoints, listenAddrs string) (*rm.Server, func())
StartSingleResourceManagerTestServer creates and starts a resource manager server with default config for testing.
func StartSingleTSOTestServer ¶
func StartSingleTSOTestServer(ctx context.Context, re *require.Assertions, backendEndpoints, listenAddrs string) (*tso.Server, func())
StartSingleTSOTestServer creates and starts a tso server with default config for testing.
func WaitForPrimaryServing ¶
WaitForPrimaryServing waits for one of servers being elected to be the primary/leader
Types ¶
type TestCluster ¶
type TestCluster struct {
// contains filtered or unexported fields
}
TestCluster is a test cluster for TSO.
func NewTestTSOCluster ¶
func NewTestTSOCluster(ctx context.Context, initialServerCount int, backendEndpoints string) (tc *TestCluster, err error)
NewTestTSOCluster creates a new TSO test cluster.
func (*TestCluster) AddServer ¶
func (tc *TestCluster) AddServer(addr string) error
AddServer adds a new TSO server to the test cluster.
func (*TestCluster) Destroy ¶
func (tc *TestCluster) Destroy()
Destroy stops and destroy the test cluster.
func (*TestCluster) DestroyServer ¶
func (tc *TestCluster) DestroyServer(addr string)
DestroyServer stops and destroy the test server by the given address.
func (*TestCluster) GetPrimary ¶
func (tc *TestCluster) GetPrimary(keyspaceID, keyspaceGroupID uint32) *tso.Server
GetPrimary returns the primary TSO server.
func (*TestCluster) GetServer ¶
func (tc *TestCluster) GetServer(addr string) *tso.Server
GetServer returns the TSO server by the given address.
func (*TestCluster) GetServers ¶
func (tc *TestCluster) GetServers() map[string]*tso.Server
GetServers returns all TSO servers.
func (*TestCluster) WaitForDefaultPrimaryServing ¶
func (tc *TestCluster) WaitForDefaultPrimaryServing(re *require.Assertions) string
WaitForDefaultPrimaryServing waits for one of servers being elected to be the primary/leader of the default keyspace.
func (*TestCluster) WaitForPrimaryServing ¶
func (tc *TestCluster) WaitForPrimaryServing(re *require.Assertions, keyspaceID, keyspaceGroupID uint32) string
WaitForPrimaryServing waits for one of servers being elected to be the primary/leader of the given keyspace.