Documentation ¶
Index ¶
- Constants
- func AddSemiSyncKeyspace(t *testing.T, clusterInfo *VTOrcClusterInfo)
- func ChangePrivileges(t *testing.T, sql string, tablet *cluster.Vttablet, user string)
- func CheckPrimaryTablet(t *testing.T, clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet, ...)
- func CheckReplication(t *testing.T, clusterInfo *VTOrcClusterInfo, primary *cluster.Vttablet, ...)
- func CheckSourcePort(t *testing.T, replica *cluster.Vttablet, source *cluster.Vttablet, ...)
- func CheckTabletUptoDate(t *testing.T, clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet)
- func DisableGlobalRecoveries(t *testing.T, vtorc *cluster.VTOrcProcess)
- func EnableGlobalRecoveries(t *testing.T, vtorc *cluster.VTOrcProcess)
- func IsPrimarySemiSyncSetupCorrectly(t *testing.T, tablet *cluster.Vttablet, semiSyncVal string) bool
- func IsSemiSyncSetupCorrectly(t *testing.T, tablet *cluster.Vttablet, semiSyncVal string) bool
- func KillTablets(vttablets []*cluster.Vttablet)
- func MakeAPICall(t *testing.T, vtorc *cluster.VTOrcProcess, url string) (status int, response string, err error)
- func MakeAPICallRetry(t *testing.T, vtorc *cluster.VTOrcProcess, url string, ...) (status int, response string)
- func PermanentlyRemoveVttablet(clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet)
- func PrintVTOrcLogsOnFailure(t *testing.T, clusterInstance *cluster.LocalProcessCluster)
- func ResetPrimaryLogs(t *testing.T, curPrimary *cluster.Vttablet)
- func RunSQL(t *testing.T, sql string, tablet *cluster.Vttablet, db string) (*sqltypes.Result, error)
- func RunSQLs(t *testing.T, sqls []string, tablet *cluster.Vttablet, db string) error
- func SetupVttabletsAndVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo, ...)
- func ShardPrimaryTablet(t *testing.T, clusterInfo *VTOrcClusterInfo, keyspace *cluster.Keyspace, ...) *cluster.Vttablet
- func StartVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo, orcExtraArgs []string, ...)
- func StartVttablet(t *testing.T, clusterInfo *VTOrcClusterInfo, cell string, isRdonly bool) *cluster.Vttablet
- func StopVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo)
- func VerifyWritesSucceed(t *testing.T, clusterInfo *VTOrcClusterInfo, primary *cluster.Vttablet, ...)
- func WaitForDetectedProblems(t *testing.T, vtorcInstance *cluster.VTOrcProcess, ...)
- func WaitForInstancePollSecondsExceededCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyName string, ...)
- func WaitForReadOnlyValue(t *testing.T, curPrimary *cluster.Vttablet, expectValue int64) (match bool)
- func WaitForReplicationToStop(t *testing.T, vttablet *cluster.Vttablet) error
- func WaitForSuccessfulERSCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyspace, shard string, ...)
- func WaitForSuccessfulPRSCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyspace, shard string, ...)
- func WaitForSuccessfulRecoveryCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, recoveryName string, ...)
- func WaitForTabletType(t *testing.T, tablet *cluster.Vttablet, expectedTabletType string)
- type CellInfo
- type VTOrcClusterInfo
Constants ¶
const ( Hostname = "localhost" Cell1 = "zone1" Cell2 = "zone2" )
Variables ¶
This section is empty.
Functions ¶
func AddSemiSyncKeyspace ¶ added in v0.14.0
func AddSemiSyncKeyspace(t *testing.T, clusterInfo *VTOrcClusterInfo)
AddSemiSyncKeyspace is used to setup a new keyspace with semi-sync. It creates a keyspace with 3 tablets
func ChangePrivileges ¶
ChangePrivileges is used to change the privileges of the given user. These commands are executed such that they are not replicated
func CheckPrimaryTablet ¶
func CheckPrimaryTablet(t *testing.T, clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet, checkServing bool)
CheckPrimaryTablet waits until the specified tablet becomes the primary tablet Makes sure the tablet type is primary, and its health check agrees.
func CheckReplication ¶
func CheckReplication(t *testing.T, clusterInfo *VTOrcClusterInfo, primary *cluster.Vttablet, replicas []*cluster.Vttablet, timeToWait time.Duration)
CheckReplication checks that the replication is setup correctly and writes succeed and are replicated on all the replicas
func CheckSourcePort ¶
func CheckSourcePort(t *testing.T, replica *cluster.Vttablet, source *cluster.Vttablet, timeToWait time.Duration)
CheckSourcePort is used to check that the replica has the given source port set in its MySQL instance
func CheckTabletUptoDate ¶ added in v0.18.0
func CheckTabletUptoDate(t *testing.T, clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet)
CheckTabletUptoDate verifies that the tablet has all the writes so far
func DisableGlobalRecoveries ¶ added in v0.17.6
func DisableGlobalRecoveries(t *testing.T, vtorc *cluster.VTOrcProcess)
DisableGlobalRecoveries disables global recoveries for the given VTOrc.
func EnableGlobalRecoveries ¶ added in v0.17.6
func EnableGlobalRecoveries(t *testing.T, vtorc *cluster.VTOrcProcess)
EnableGlobalRecoveries enables global recoveries for the given VTOrc.
func IsPrimarySemiSyncSetupCorrectly ¶
func IsPrimarySemiSyncSetupCorrectly(t *testing.T, tablet *cluster.Vttablet, semiSyncVal string) bool
IsPrimarySemiSyncSetupCorrectly checks that the priamry side semi-sync is setup correctly on the given vttablet
func IsSemiSyncSetupCorrectly ¶
IsSemiSyncSetupCorrectly checks that the semi-sync is setup correctly on the given vttablet
func KillTablets ¶
KillTablets is used to kill the tablets
func MakeAPICall ¶
func MakeAPICall(t *testing.T, vtorc *cluster.VTOrcProcess, url string) (status int, response string, err error)
MakeAPICall is used make an API call given the url. It returns the status and the body of the response received
func MakeAPICallRetry ¶ added in v0.15.0
func MakeAPICallRetry(t *testing.T, vtorc *cluster.VTOrcProcess, url string, retry func(int, string) bool) (status int, response string)
MakeAPICallRetry is used to make an API call and retry on the given condition. The function provided takes in the status and response and returns if we should continue to retry or not
func PermanentlyRemoveVttablet ¶
func PermanentlyRemoveVttablet(clusterInfo *VTOrcClusterInfo, tablet *cluster.Vttablet)
PermanentlyRemoveVttablet removes the tablet specified from the cluster. It makes it so that this vttablet or mysql instance are not reused for any other test.
func PrintVTOrcLogsOnFailure ¶ added in v0.15.4
func PrintVTOrcLogsOnFailure(t *testing.T, clusterInstance *cluster.LocalProcessCluster)
PrintVTOrcLogsOnFailure prints the VTOrc logs on failure of the test. This function is supposed to be called as the first defer command from the vtorc tests.
func ResetPrimaryLogs ¶
ResetPrimaryLogs is used reset the binary logs
func RunSQL ¶
func RunSQL(t *testing.T, sql string, tablet *cluster.Vttablet, db string) (*sqltypes.Result, error)
RunSQL is used to run a SQL statement on the given tablet
func SetupVttabletsAndVTOrcs ¶ added in v0.15.0
func SetupVttabletsAndVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo, numReplicasReqCell1, numRdonlyReqCell1 int, orcExtraArgs []string, config cluster.VTOrcConfiguration, vtorcCount int, durability string)
SetupVttabletsAndVTOrcs is used to setup the vttablets and start the vtorcs
func ShardPrimaryTablet ¶
func ShardPrimaryTablet(t *testing.T, clusterInfo *VTOrcClusterInfo, keyspace *cluster.Keyspace, shard *cluster.Shard) *cluster.Vttablet
ShardPrimaryTablet waits until a primary tablet has been elected for the given shard and returns it
func StartVTOrcs ¶ added in v0.15.0
func StartVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo, orcExtraArgs []string, config cluster.VTOrcConfiguration, count int)
StartVTOrcs is used to start the vtorcs with the given extra arguments
func StartVttablet ¶
func StartVttablet(t *testing.T, clusterInfo *VTOrcClusterInfo, cell string, isRdonly bool) *cluster.Vttablet
StartVttablet is used to start a vttablet from the given cell and type
func StopVTOrcs ¶ added in v0.15.0
func StopVTOrcs(t *testing.T, clusterInfo *VTOrcClusterInfo)
StopVTOrcs is used to stop the vtorcs
func VerifyWritesSucceed ¶
func VerifyWritesSucceed(t *testing.T, clusterInfo *VTOrcClusterInfo, primary *cluster.Vttablet, replicas []*cluster.Vttablet, timeToWait time.Duration)
VerifyWritesSucceed inserts more data into the table vt_insert_test and checks that it is replicated too Call this function only after CheckReplication has been executed once, since that function creates the table that this function uses.
func WaitForDetectedProblems ¶ added in v0.18.0
func WaitForDetectedProblems(t *testing.T, vtorcInstance *cluster.VTOrcProcess, code, alias, ks, shard string, expect int)
WaitForDetectedProblems waits until the given analysis code, alias, keyspace and shard count matches the count expected.
func WaitForInstancePollSecondsExceededCount ¶ added in v0.17.0
func WaitForInstancePollSecondsExceededCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyName string, minCountExpected float64, enforceEquality bool)
WaitForInstancePollSecondsExceededCount waits for 30 seconds and then queries api/aggregated-discovery-metrics. It expects to find minimum occurrence or exact count of `keyName` provided.
func WaitForReadOnlyValue ¶ added in v0.14.0
func WaitForReadOnlyValue(t *testing.T, curPrimary *cluster.Vttablet, expectValue int64) (match bool)
WaitForReadOnlyValue waits for the read_only global variable to reach the provided value
func WaitForReplicationToStop ¶
WaitForReplicationToStop waits for replication to stop on the given tablet
func WaitForSuccessfulERSCount ¶ added in v0.18.0
func WaitForSuccessfulERSCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyspace, shard string, countExpected int)
WaitForSuccessfulERSCount waits until the given keyspace-shard's count of successful ers runs matches the count expected.
func WaitForSuccessfulPRSCount ¶ added in v0.18.0
func WaitForSuccessfulPRSCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, keyspace, shard string, countExpected int)
WaitForSuccessfulPRSCount waits until the given keyspace-shard's count of successful prs runs matches the count expected.
func WaitForSuccessfulRecoveryCount ¶ added in v0.15.0
func WaitForSuccessfulRecoveryCount(t *testing.T, vtorcInstance *cluster.VTOrcProcess, recoveryName string, countExpected int)
WaitForSuccessfulRecoveryCount waits until the given recovery name's count of successful runs matches the count expected
Types ¶
type CellInfo ¶
type CellInfo struct { CellName string ReplicaTablets []*cluster.Vttablet RdonlyTablets []*cluster.Vttablet // constants that should be set in TestMain NumReplicas int NumRdonly int UIDBase int }
CellInfo stores the information regarding 1 cell including the tablets it contains
type VTOrcClusterInfo ¶ added in v0.15.0
type VTOrcClusterInfo struct { ClusterInstance *cluster.LocalProcessCluster Ts *topo.Server CellInfos []*CellInfo // contains filtered or unexported fields }
VTOrcClusterInfo stores the information for a cluster. This is supposed to be used only for VTOrc tests.
func CreateClusterAndStartTopo ¶
func CreateClusterAndStartTopo(cellInfos []*CellInfo) (*VTOrcClusterInfo, error)
CreateClusterAndStartTopo starts the cluster and topology service
func SetupNewClusterSemiSync ¶
func SetupNewClusterSemiSync(t *testing.T) *VTOrcClusterInfo
SetupNewClusterSemiSync is used to setup a new cluster with semi-sync set. It creates a cluster with 4 tablets, one of which is a Replica