mcs

package module
v0.0.0-...-a6ee7d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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

func WaitForPrimaryServing(re *require.Assertions, serverMap map[string]bs.Server) string

WaitForPrimaryServing waits for one of servers being elected to be the primary/leader

func WaitForTSOServiceAvailable

func WaitForTSOServiceAvailable(ctx context.Context, pdClient tm.Client) error

WaitForTSOServiceAvailable waits for the tm client being served by the tso server side

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL