utils

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 20 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. This should not generally be called directly, instead use the WaitForReplicationToCatchup method.

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 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, durability string) *cluster.LocalProcessCluster

SetupReparentCluster is used to setup the reparent cluster

func StartNewVTTablet added in v0.15.0

func StartNewVTTablet(t *testing.T, clusterInstance *cluster.LocalProcessCluster, uuid int, supportsBackup bool) *cluster.Vttablet

StartNewVTTablet starts a new vttablet instance

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. When run in a CI environment -- which is considered true when the "CI" env variable is set to "true" -- the teardown also removes the VTDATAROOT directory that was used for the test/cluster.

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.

func WaitForReplicationToStart added in v0.15.0

func WaitForReplicationToStart(t *testing.T, clusterInstance *cluster.LocalProcessCluster, keyspaceName, shardName string, tabletCnt int, doPrint bool)

func WaitForTabletToBeServing added in v0.15.4

func WaitForTabletToBeServing(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, timeout time.Duration)

Types

This section is empty.

Jump to

Keyboard shortcuts

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