utils

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyspaceName = "ks"

	Hostname = "localhost"

	ShardName     = "0"
	KeyspaceShard = KeyspaceName + "/" + ShardName
)

Functions

func CheckCountOfInsertedValues

func CheckCountOfInsertedValues(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, count int) error

CheckCountOfInsertedValues checks that the number of inserted values matches the given count on the given tablet

func CheckDBstatus

func CheckDBstatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, variable string, status string)

CheckDBstatus checks the db status

func CheckDBvar

func CheckDBvar(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, variable string, status string)

CheckDBvar checks the db var

func CheckInsertedValues

func CheckInsertedValues(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, index int) error

CheckInsertedValues checks that the given value is present in the given tablet

func CheckPrimaryTablet

func CheckPrimaryTablet(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet)

CheckPrimaryTablet makes sure the tablet type is primary, and its health check agrees.

func CheckReparentFromOutside

func CheckReparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, downPrimary bool, baseTime int64)

CheckReparentFromOutside checks that cluster was reparented from outside

func CheckReplicaStatus

func CheckReplicaStatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet)

CheckReplicaStatus checks the replication status and asserts that the replication is stopped

func CheckReplicationStatus

func CheckReplicationStatus(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, sqlThreadRunning bool, ioThreadRunning bool)

CheckReplicationStatus checks that the replication for sql and io threads is setup as expected

func CheckSemiSyncSetupCorrectly

func CheckSemiSyncSetupCorrectly(t *testing.T, tablet *cluster.Vttablet, semiSyncVal string)

func ConfirmOldPrimaryIsHangingAround

func ConfirmOldPrimaryIsHangingAround(t *testing.T, clusterInstance *cluster.LocalProcessCluster)

ConfirmOldPrimaryIsHangingAround confirms that the old primary is hanging around

func ConfirmReplication

func ConfirmReplication(t *testing.T, primary *cluster.Vttablet, replicas []*cluster.Vttablet) int

ConfirmReplication confirms that the replication is working properly

func DeleteTablet

func DeleteTablet(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet)

DeleteTablet is used to delete the given tablet

func Ers

func Ers(clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet, totalTimeout, waitReplicasTimeout string) (string, error)

Ers runs the ERS

func ErsIgnoreTablet

func ErsIgnoreTablet(clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet, timeout, waitReplicasTimeout string, tabletsToIgnore []*cluster.Vttablet, preventCrossCellPromotion bool) (string, error)

ErsIgnoreTablet is used to run ERS

func ErsWithVtctl

func ErsWithVtctl(clusterInstance *cluster.LocalProcessCluster) (string, error)

ErsWithVtctl runs ERS via vtctl binary

func GetNewPrimary

func GetNewPrimary(t *testing.T, clusterInstance *cluster.LocalProcessCluster) *cluster.Vttablet

GetNewPrimary is used to find the new primary of the cluster.

func GetShardReplicationPositions

func GetShardReplicationPositions(t *testing.T, clusterInstance *cluster.LocalProcessCluster, keyspaceName, shardName string, doPrint bool) []string

GetShardReplicationPositions gets the shards replication positions.

func Prs

func Prs(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet) (string, error)

Prs runs PRS

func PrsAvoid

func PrsAvoid(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet) (string, error)

PrsAvoid runs PRS

func PrsWithTimeout

func PrsWithTimeout(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet, avoid bool, actionTimeout, waitTimeout string) (string, error)

PrsWithTimeout runs PRS

func ReplicationThreadsStatus added in v0.14.0

func ReplicationThreadsStatus(t *testing.T, status *replicationdatapb.Status, vtctlVersion, vttabletVersion int) (bool, bool)

ReplicationThreadsStatus returns the status of the IO and SQL thread. It reads the result of the replication status based on the vtctl major version provided. It also uses the vttabletVersion to assert on the expectation of the new fields being unknown for the old vttablets and that they match for the new vttablets

func RestartTablet

func RestartTablet(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet)

RestartTablet restarts the tablet

func ResurrectTablet

func ResurrectTablet(ctx context.Context, t *testing.T, clusterInstance *cluster.LocalProcessCluster, tab *cluster.Vttablet)

ResurrectTablet is used to resurrect the given tablet

func RunSQL

func RunSQL(ctx context.Context, t *testing.T, sql string, tablet *cluster.Vttablet) *sqltypes.Result

RunSQL is used to run a SQL command directly on the MySQL instance of a vttablet

func SetReplicationSourceFailed

func SetReplicationSourceFailed(tablet *cluster.Vttablet, prsOut string) bool

SetReplicationSourceFailed returns true if the given output from PRS had failed because the given tablet was unable to setReplicationSource. Since some tests are used in upgrade-downgrade testing, we need this function to work with different versions of vtctl.

func SetupRangeBasedCluster

func SetupRangeBasedCluster(ctx context.Context, t *testing.T) *cluster.LocalProcessCluster

SetupRangeBasedCluster sets up the range based cluster

func SetupReparentCluster

func SetupReparentCluster(t *testing.T, enableSemiSync bool) *cluster.LocalProcessCluster

SetupReparentCluster is used to setup the reparent cluster

func SetupReparentClusterLegacy added in v0.14.0

func SetupReparentClusterLegacy(t *testing.T, enableSemiSync bool) *cluster.LocalProcessCluster

SetupReparentClusterLegacy is used to setup the reparent cluster

func StopTablet

func StopTablet(t *testing.T, tab *cluster.Vttablet, stopDatabase bool)

StopTablet stops the tablet

func TeardownCluster

func TeardownCluster(clusterInstance *cluster.LocalProcessCluster)

TeardownCluster is used to teardown the reparent cluster

func TmcFullStatus added in v0.14.0

func TmcFullStatus(ctx context.Context, tablet *cluster.Vttablet) (*replicationdatapb.FullStatus, error)

TmcFullStatus retuns the result of the TabletManagerClient RPC FullStatus

func ValidateTopology

func ValidateTopology(t *testing.T, clusterInstance *cluster.LocalProcessCluster, pingTablets bool)

ValidateTopology is used to validate the topology

func WaitForReplicationPosition

func WaitForReplicationPosition(t *testing.T, tabletA *cluster.Vttablet, tabletB *cluster.Vttablet) error

WaitForReplicationPosition waits for tablet B to catch up to the replication position of tablet A.

Types

This section is empty.

Jump to

Keyboard shortcuts

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