Documentation ¶
Index ¶
- Constants
- Variables
- func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.LocalProcessCluster, lag time.Duration)
- func ThrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
- func ThrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...) (string, error)
- func UnthrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
- func UnthrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...) (string, error)
- func UpdateThrottlerTopoConfig(clusterInstance *cluster.LocalProcessCluster, enable bool, disable bool, ...) (string, error)
- func UpdateThrottlerTopoConfigRaw(vtctldProcess *cluster.VtctldClientProcess, keyspaceName string, enable bool, ...) (result string, err error)
- func WaitForSrvKeyspace(clusterInstance *cluster.LocalProcessCluster, cell, keyspace string) error
- func WaitForThrottledApp(t *testing.T, tablet *cluster.Vttablet, throttlerApp throttlerapp.Name, ...)
- func WaitForThrottlerStatusEnabled(t *testing.T, tablet *cluster.Vttablet, enabled bool, config *Config, ...)
- func WaitForValidData(t *testing.T, tablet *cluster.Vttablet, timeout time.Duration)
- func WaitUntilTabletsConfirmThrottledApp(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...)
- type Config
Constants ¶
const ( DefaultQuery = "select unix_timestamp(now(6))-max(ts/1000000000) as replication_lag from _vt.heartbeat" DefaultThreshold = 5 * time.Second ConfigTimeout = 60 * time.Second )
Variables ¶
var DefaultConfig = &Config{ Query: DefaultQuery, Threshold: DefaultThreshold.Seconds(), }
Functions ¶
func EnableLagThrottlerAndWaitForStatus ¶
func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.LocalProcessCluster, lag time.Duration)
EnableLagThrottlerAndWaitForStatus is a utility function to enable the throttler at the beginning of an endtoend test. The throttler is configued to use the standard replication lag metric. The function waits until the throttler is confirmed to be running on all tablets.
func ThrottleApp ¶
func ThrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleApp throttles given app name for the next hour
func ThrottleAppAndWaitUntilTabletsConfirm ¶
func ThrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleAppAndWaitUntilTabletsConfirm
func UnthrottleApp ¶
func UnthrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleApp unthrottles given app name
func UnthrottleAppAndWaitUntilTabletsConfirm ¶
func UnthrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
UnthrottleAppAndWaitUntilTabletsConfirm
func UpdateThrottlerTopoConfig ¶
func UpdateThrottlerTopoConfig(clusterInstance *cluster.LocalProcessCluster, enable bool, disable bool, threshold float64, metricsQuery string, appRule *topodatapb.ThrottledAppRule) (string, error)
UpdateThrottlerTopoConfig runs vtctlclient UpdateThrottlerConfig. This retries the command until it succeeds or times out as the SrvKeyspace record may not yet exist for a newly created Keyspace that is still initializing before it becomes serving.
func UpdateThrottlerTopoConfigRaw ¶
func UpdateThrottlerTopoConfigRaw(vtctldProcess *cluster.VtctldClientProcess, keyspaceName string, enable bool, disable bool, threshold float64, metricsQuery string, appRule *topodatapb.ThrottledAppRule) (result string, err error)
UpdateThrottlerTopoConfig runs vtctlclient UpdateThrottlerConfig. This retries the command until it succeeds or times out as the SrvKeyspace record may not yet exist for a newly created Keyspace that is still initializing before it becomes serving.
func WaitForSrvKeyspace ¶
func WaitForSrvKeyspace(clusterInstance *cluster.LocalProcessCluster, cell, keyspace string) error
WaitForSrvKeyspace waits until the given srvkeyspace entry is found in the given cell
func WaitForThrottledApp ¶
func WaitForThrottledApp(t *testing.T, tablet *cluster.Vttablet, throttlerApp throttlerapp.Name, expectThrottled bool, timeout time.Duration)
WaitForThrottlerStatusEnabled waits for a tablet to report its throttler status as enabled/disabled and have the provided config (if any) until the specified timeout.
func WaitForThrottlerStatusEnabled ¶
func WaitForThrottlerStatusEnabled(t *testing.T, tablet *cluster.Vttablet, enabled bool, config *Config, timeout time.Duration)
WaitForThrottlerStatusEnabled waits for a tablet to report its throttler status as enabled/disabled and have the provided config (if any) until the specified timeout.
func WaitForValidData ¶
WaitForValidData waits for a tablet's checks to return a non 500 http response which indicates that it's not able to provide valid results. This is most commonly caused by the throttler still gathering the initial results for the given configuration.
func WaitUntilTabletsConfirmThrottledApp ¶
func WaitUntilTabletsConfirmThrottledApp(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name, expectThrottled bool)