Documentation ¶
Index ¶
- Variables
- func CreateMockStore(t testing.TB, opts ...mockstore.MockTiKVStoreOption) kv.Storage
- func CreateMockStoreAndDomain(t testing.TB, opts ...mockstore.MockTiKVStoreOption) (kv.Storage, *domain.Domain)
- func CreateMockStoreAndDomainWithSchemaLease(t testing.TB, lease time.Duration, opts ...mockstore.MockTiKVStoreOption) (kv.Storage, *domain.Domain)
- func CreateMockStoreWithSchemaLease(t testing.TB, lease time.Duration, opts ...mockstore.MockTiKVStoreOption) kv.Storage
- func EnableFailPoint(t testing.TB, name, expr string)
- func GetStack() []byte
- func MockTiDBStatusPort(ctx context.Context, b *testing.B, port string) *util.WaitGroupWrapper
- func NewSession(t testing.TB, store kv.Storage) sessiontypes.Session
- func Rows(args ...string) [][]any
- func RowsWithSep(sep string, args ...string) [][]any
- func TryRetrieveSession(ctx context.Context) sessiontypes.Session
- func WithPruneMode(tk *TestKit, mode variable.PartitionPruneMode, f func())
- type AsyncTestKit
- func (tk *AsyncTestKit) CloseSession(ctx context.Context)
- func (tk *AsyncTestKit) ConcurrentRun(concurrent int, loops int, ...)
- func (tk *AsyncTestKit) Exec(ctx context.Context, sql string, args ...any) (sqlexec.RecordSet, error)
- func (tk *AsyncTestKit) ExecToErr(ctx context.Context, sql string, args ...any) error
- func (tk *AsyncTestKit) MustExec(ctx context.Context, sql string, args ...any)
- func (tk *AsyncTestKit) MustGetErrMsg(ctx context.Context, sql string, errStr string)
- func (tk *AsyncTestKit) MustQuery(ctx context.Context, sql string, args ...any) *Result
- func (tk *AsyncTestKit) OpenSession(ctx context.Context, db string) context.Context
- type DBTestKit
- func (tk *DBTestKit) GetDB() *sql.DB
- func (tk *DBTestKit) MustExec(sql string, args ...any) sql.Result
- func (tk *DBTestKit) MustExecPrepared(stmt *sql.Stmt, args ...any) sql.Result
- func (tk *DBTestKit) MustPrepare(query string) *sql.Stmt
- func (tk *DBTestKit) MustQuery(sql string, args ...any) *sql.Rows
- func (tk *DBTestKit) MustQueryPrepared(stmt *sql.Stmt, args ...any) *sql.Rows
- func (tk *DBTestKit) MustQueryRows(query string, args ...any)
- type DistExecutionContext
- func (d *DistExecutionContext) AddDomain()
- func (d *DistExecutionContext) Close()
- func (d *DistExecutionContext) DeleteDomain(idx int)
- func (d *DistExecutionContext) GetDomain(idx int) *domain.Domain
- func (d *DistExecutionContext) GetDomainCnt() int
- func (d *DistExecutionContext) InitOwner()
- func (d *DistExecutionContext) SetOwner(idx int)
- type MockPumpClient
- type MockSessionManager
- func (msm *MockSessionManager) CheckOldRunningTxn(job2ver map[int64]int64, job2ids map[int64]string)
- func (msm *MockSessionManager) DeleteInternalSession(s any)
- func (msm *MockSessionManager) GetAutoAnalyzeProcID() uint64
- func (msm *MockSessionManager) GetConAttrs(user *auth.UserIdentity) map[uint64]map[string]string
- func (msm *MockSessionManager) GetInternalSessionStartTSList() []uint64
- func (msm *MockSessionManager) GetProcessInfo(id uint64) (*util.ProcessInfo, bool)
- func (*MockSessionManager) Kill(uint64, bool, bool)
- func (*MockSessionManager) KillAllConnections()
- func (msm *MockSessionManager) KillNonFlashbackClusterConn()
- func (msm *MockSessionManager) ServerID() uint64
- func (msm *MockSessionManager) ShowProcessList() map[uint64]*util.ProcessInfo
- func (msm *MockSessionManager) ShowTxnList() []*txninfo.TxnInfo
- func (msm *MockSessionManager) StoreInternalSession(s any)
- func (*MockSessionManager) UpdateTLSConfig(*tls.Config)
- type RegionProperityClient
- type Result
- func (res *Result) AddComment(c string)
- func (res *Result) Check(expected [][]any)
- func (res *Result) CheckAt(cols []int, expected [][]any)
- func (res *Result) CheckContain(expected string)
- func (res *Result) CheckNotContain(unexpected string)
- func (res *Result) CheckWithFunc(expected [][]any, f func([]string, []any) bool)
- func (res *Result) Equal(expected [][]any) bool
- func (res *Result) MultiCheckContain(expecteds []string)
- func (res *Result) MultiCheckNotContain(unexpecteds []string)
- func (res *Result) Rows() [][]any
- func (res *Result) Sort() *Result
- type SteppedTestKit
- func (tk *SteppedTestKit) Continue() *SteppedTestKit
- func (tk *SteppedTestKit) ExpectIdle()
- func (tk *SteppedTestKit) ExpectStopOnAnyBreakPoint()
- func (tk *SteppedTestKit) ExpectStopOnBreakPoint(breakPoint string)
- func (tk *SteppedTestKit) GetQueryResult() *Result
- func (tk *SteppedTestKit) GetResult() any
- func (tk *SteppedTestKit) MustExec(sql string, args ...any)
- func (tk *SteppedTestKit) MustQuery(sql string, args ...any) *Result
- func (tk *SteppedTestKit) SetBreakPoints(breakPoints ...string)
- func (tk *SteppedTestKit) SteppedMustExec(sql string, args ...any) *SteppedTestKit
- func (tk *SteppedTestKit) SteppedMustQuery(sql string, args ...any) *SteppedTestKit
- type TestKit
- func (tk *TestKit) CheckExecResult(affectedRows, insertID int64)
- func (tk *TestKit) CheckLastMessage(msg string)
- func (tk *TestKit) EventuallyMustIndexLookup(sql string, args ...any) *Result
- func (tk *TestKit) EventuallyMustQueryAndCheck(sql string, args []any, expected [][]any, waitFor time.Duration, ...)
- func (tk *TestKit) Exec(sql string, args ...any) (sqlexec.RecordSet, error)
- func (tk *TestKit) ExecToErr(sql string, args ...any) error
- func (tk *TestKit) ExecWithContext(ctx context.Context, sql string, args ...any) (rs sqlexec.RecordSet, err error)
- func (tk *TestKit) HasKeywordInOperatorInfo(sql string, keyword string, args ...any) bool
- func (tk *TestKit) HasPlan4ExplainFor(result *Result, plan string) bool
- func (tk *TestKit) HasPlanForLastExecution(plan string) bool
- func (tk *TestKit) HasTiFlashPlan(sql string, args ...any) bool
- func (tk *TestKit) MustContainErrMsg(sql string, errStr any)
- func (tk *TestKit) MustExec(sql string, args ...any)
- func (tk *TestKit) MustExecToErr(sql string, args ...any)
- func (tk *TestKit) MustExecWithContext(ctx context.Context, sql string, args ...any)
- func (tk *TestKit) MustGetDBError(sql string, dberr *terror.Error)
- func (tk *TestKit) MustGetErrCode(sql string, errCode int)
- func (tk *TestKit) MustGetErrMsg(sql string, errStr string)
- func (tk *TestKit) MustHavePlan(sql string, plan string, args ...any)
- func (tk *TestKit) MustIndexLookup(sql string, args ...any) *Result
- func (tk *TestKit) MustMatchErrMsg(sql string, errRx any)
- func (tk *TestKit) MustNoGlobalStats(table string) bool
- func (tk *TestKit) MustNotHavePlan(sql string, plan string, args ...any)
- func (tk *TestKit) MustPartition(sql string, partitions string, args ...any) *Result
- func (tk *TestKit) MustPartitionByList(sql string, partitions []string, args ...any) *Result
- func (tk *TestKit) MustPointGet(sql string, args ...any) *Result
- func (tk *TestKit) MustQuery(sql string, args ...any) *Result
- func (tk *TestKit) MustQueryWithContext(ctx context.Context, sql string, args ...any) *Result
- func (tk *TestKit) MustUseIndex(sql string, index string, args ...any) bool
- func (tk *TestKit) MustUseIndex4ExplainFor(result *Result, index string) bool
- func (tk *TestKit) NotHasKeywordInOperatorInfo(sql string, keyword string, args ...any) bool
- func (tk *TestKit) QueryToErr(sql string, args ...any) error
- func (tk *TestKit) RefreshConnectionID()
- func (tk *TestKit) RefreshSession()
- func (tk *TestKit) RequireEqual(expected any, actual any, msgAndArgs ...any)
- func (tk *TestKit) RequireNoError(err error, msgAndArgs ...any)
- func (tk *TestKit) RequireNotEqual(expected any, actual any, msgAndArgs ...any)
- func (tk *TestKit) ResultSetToResult(rs sqlexec.RecordSet, comment string) *Result
- func (tk *TestKit) ResultSetToResultWithCtx(ctx context.Context, rs sqlexec.RecordSet, comment string) *Result
- func (tk *TestKit) Session() sessiontypes.Session
- func (tk *TestKit) SetSession(session sessiontypes.Session)
- func (tk *TestKit) UsedPartitions(sql string, args ...any) *Result
Constants ¶
This section is empty.
Variables ¶
var WithTiKV = flag.String("with-tikv", "", "address of tikv cluster, if set, running test with real tikv cluster")
WithTiKV flag is only used for debugging locally with real tikv cluster.
Functions ¶
func CreateMockStore ¶
CreateMockStore return a new mock kv.Storage.
func CreateMockStoreAndDomain ¶
func CreateMockStoreAndDomain(t testing.TB, opts ...mockstore.MockTiKVStoreOption) (kv.Storage, *domain.Domain)
CreateMockStoreAndDomain return a new mock kv.Storage and *domain.Domain.
func CreateMockStoreAndDomainWithSchemaLease ¶
func CreateMockStoreAndDomainWithSchemaLease(t testing.TB, lease time.Duration, opts ...mockstore.MockTiKVStoreOption) (kv.Storage, *domain.Domain)
CreateMockStoreAndDomainWithSchemaLease return a new mock kv.Storage and *domain.Domain.
func CreateMockStoreWithSchemaLease ¶
func CreateMockStoreWithSchemaLease(t testing.TB, lease time.Duration, opts ...mockstore.MockTiKVStoreOption) kv.Storage
CreateMockStoreWithSchemaLease return a new mock kv.Storage.
func EnableFailPoint ¶
EnableFailPoint enables fail-point, and disable it when test finished.
func MockTiDBStatusPort ¶
MockTiDBStatusPort mock the TiDB server status port to have metrics.
func NewSession ¶
NewSession creates a new session environment for test.
func RowsWithSep ¶
RowsWithSep is a convenient function to wrap args to a slice of []interface. The arg represents a row, split by sep.
func TryRetrieveSession ¶
func TryRetrieveSession(ctx context.Context) sessiontypes.Session
TryRetrieveSession tries retrieve session from context.
func WithPruneMode ¶
func WithPruneMode(tk *TestKit, mode variable.PartitionPruneMode, f func())
WithPruneMode run test case under prune mode.
Types ¶
type AsyncTestKit ¶
type AsyncTestKit struct {
// contains filtered or unexported fields
}
AsyncTestKit is a utility to run sql concurrently.
func NewAsyncTestKit ¶
func NewAsyncTestKit(t *testing.T, store kv.Storage) *AsyncTestKit
NewAsyncTestKit returns a new *AsyncTestKit.
func (*AsyncTestKit) CloseSession ¶
func (tk *AsyncTestKit) CloseSession(ctx context.Context)
CloseSession closes exists session from ctx.
func (*AsyncTestKit) ConcurrentRun ¶
func (tk *AsyncTestKit) ConcurrentRun( concurrent int, loops int, prepareFunc func(ctx context.Context, tk *AsyncTestKit, concurrent int, currentLoop int) [][][]any, writeFunc func(ctx context.Context, tk *AsyncTestKit, input [][]any), checkFunc func(ctx context.Context, tk *AsyncTestKit), )
ConcurrentRun run test in current. - concurrent: controls the concurrent worker count. - loops: controls run test how much times. - prepareFunc: provide test data and will be called for every loop. - checkFunc: used to do some check after all workers done. works like create table better be put in front of this method calling. see more example at TestBatchInsertWithOnDuplicate
func (*AsyncTestKit) Exec ¶
func (tk *AsyncTestKit) Exec(ctx context.Context, sql string, args ...any) (sqlexec.RecordSet, error)
Exec executes a sql statement.
func (*AsyncTestKit) MustExec ¶
func (tk *AsyncTestKit) MustExec(ctx context.Context, sql string, args ...any)
MustExec executes a sql statement and asserts nil error.
func (*AsyncTestKit) MustGetErrMsg ¶
func (tk *AsyncTestKit) MustGetErrMsg(ctx context.Context, sql string, errStr string)
MustGetErrMsg executes a sql statement and assert its error message.
func (*AsyncTestKit) MustQuery ¶
MustQuery query the statements and returns result rows. If expected result is set it asserts the query result equals expected result.
func (*AsyncTestKit) OpenSession ¶
OpenSession opens new session ctx if no exists one and use db.
type DBTestKit ¶
type DBTestKit struct {
// contains filtered or unexported fields
}
DBTestKit is a utility to run sql with a db connection.
func NewDBTestKit ¶
NewDBTestKit returns a new *DBTestKit.
func (*DBTestKit) MustExecPrepared ¶
MustExecPrepared executes a prepared statement with the given arguments and returns a Result summarizing the effect of the statement.
func (*DBTestKit) MustPrepare ¶
MustPrepare creates a prepared statement for later queries or executions.
func (*DBTestKit) MustQueryPrepared ¶
MustQueryPrepared executes a prepared query statement with the given arguments and returns the query results as a *Rows.
func (*DBTestKit) MustQueryRows ¶
MustQueryRows query the statements
type DistExecutionContext ¶
DistExecutionContext is the context that used in Distributed execution test for Dist task framework and DDL.
func NewDistExecutionContext ¶
func NewDistExecutionContext(t testing.TB, serverNum int) *DistExecutionContext
NewDistExecutionContext create DistExecutionContext for testing.
func (*DistExecutionContext) AddDomain ¶
func (d *DistExecutionContext) AddDomain()
AddDomain add 1 domain which is not ddl owner.
func (*DistExecutionContext) Close ¶
func (d *DistExecutionContext) Close()
Close cleanup running goroutines, release resources used.
func (*DistExecutionContext) DeleteDomain ¶
func (d *DistExecutionContext) DeleteDomain(idx int)
DeleteDomain delete 1 domain by idx, set server0 as ddl owner if the deleted owner is ddl owner.
func (*DistExecutionContext) GetDomain ¶
func (d *DistExecutionContext) GetDomain(idx int) *domain.Domain
GetDomain get domain by index.
func (*DistExecutionContext) GetDomainCnt ¶
func (d *DistExecutionContext) GetDomainCnt() int
GetDomainCnt get domain count.
func (*DistExecutionContext) InitOwner ¶
func (d *DistExecutionContext) InitOwner()
InitOwner select the last domain as DDL owner.
func (*DistExecutionContext) SetOwner ¶
func (d *DistExecutionContext) SetOwner(idx int)
SetOwner set one mock domain to DDL Owner by idx.
type MockPumpClient ¶
type MockPumpClient struct{}
MockPumpClient is a mock pump client.
func (MockPumpClient) PullBinlogs ¶
func (m MockPumpClient) PullBinlogs(ctx context.Context, in *binlog.PullBinlogReq, opts ...grpc.CallOption) (binlog.Pump_PullBinlogsClient, error)
PullBinlogs is a mock method.
func (MockPumpClient) WriteBinlog ¶
func (m MockPumpClient) WriteBinlog(ctx context.Context, in *binlog.WriteBinlogReq, opts ...grpc.CallOption) (*binlog.WriteBinlogResp, error)
WriteBinlog is a mock method.
type MockSessionManager ¶
type MockSessionManager struct { PS []*util.ProcessInfo PSMu sync.RWMutex SerID uint64 TxnInfo []*txninfo.TxnInfo Dom *domain.Domain Conn map[uint64]sessiontypes.Session ConAttrs map[uint64]map[string]string // contains filtered or unexported fields }
MockSessionManager is a mocked session manager which is used for test.
func (*MockSessionManager) CheckOldRunningTxn ¶
func (msm *MockSessionManager) CheckOldRunningTxn(job2ver map[int64]int64, job2ids map[int64]string)
CheckOldRunningTxn is to get all startTS of every transactions running in the current internal sessions
func (*MockSessionManager) DeleteInternalSession ¶
func (msm *MockSessionManager) DeleteInternalSession(s any)
DeleteInternalSession is to delete the internal session pointer from the map in the SessionManager
func (*MockSessionManager) GetAutoAnalyzeProcID ¶
func (msm *MockSessionManager) GetAutoAnalyzeProcID() uint64
GetAutoAnalyzeProcID implement SessionManager interface.
func (*MockSessionManager) GetConAttrs ¶
func (msm *MockSessionManager) GetConAttrs(user *auth.UserIdentity) map[uint64]map[string]string
GetConAttrs returns the connection attributes of all connections
func (*MockSessionManager) GetInternalSessionStartTSList ¶
func (msm *MockSessionManager) GetInternalSessionStartTSList() []uint64
GetInternalSessionStartTSList is to get all startTS of every transaction running in the current internal sessions
func (*MockSessionManager) GetProcessInfo ¶
func (msm *MockSessionManager) GetProcessInfo(id uint64) (*util.ProcessInfo, bool)
GetProcessInfo implements the SessionManager.GetProcessInfo interface.
func (*MockSessionManager) Kill ¶
func (*MockSessionManager) Kill(uint64, bool, bool)
Kill implements the SessionManager.Kill interface.
func (*MockSessionManager) KillAllConnections ¶
func (*MockSessionManager) KillAllConnections()
KillAllConnections implements the SessionManager.KillAllConnections interface.
func (*MockSessionManager) KillNonFlashbackClusterConn ¶
func (msm *MockSessionManager) KillNonFlashbackClusterConn()
KillNonFlashbackClusterConn implement SessionManager interface.
func (*MockSessionManager) ServerID ¶
func (msm *MockSessionManager) ServerID() uint64
ServerID get server id.
func (*MockSessionManager) ShowProcessList ¶
func (msm *MockSessionManager) ShowProcessList() map[uint64]*util.ProcessInfo
ShowProcessList implements the SessionManager.ShowProcessList interface.
func (*MockSessionManager) ShowTxnList ¶
func (msm *MockSessionManager) ShowTxnList() []*txninfo.TxnInfo
ShowTxnList is to show txn list.
func (*MockSessionManager) StoreInternalSession ¶
func (msm *MockSessionManager) StoreInternalSession(s any)
StoreInternalSession is to store internal session.
func (*MockSessionManager) UpdateTLSConfig ¶
func (*MockSessionManager) UpdateTLSConfig(*tls.Config)
UpdateTLSConfig implements the SessionManager.UpdateTLSConfig interface.
type RegionProperityClient ¶
RegionProperityClient is to get region properties.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is the result returned by MustQuery.
func (*Result) AddComment ¶
AddComment adds the extra comment for the Result's output.
func (*Result) CheckAt ¶
CheckAt asserts the result of selected columns equals the expected results.
func (*Result) CheckContain ¶
CheckContain checks whether the result contains the expected string
func (*Result) CheckNotContain ¶
CheckNotContain checks whether the result doesn't contain the expected string
func (*Result) CheckWithFunc ¶
CheckWithFunc asserts the result match the expected results in the way `f` specifies.
func (*Result) MultiCheckContain ¶
MultiCheckContain checks whether the result contains strings in `expecteds`
func (*Result) MultiCheckNotContain ¶
MultiCheckNotContain checks whether the result doesn't contain the strings in `expected`
type SteppedTestKit ¶
type SteppedTestKit struct {
// contains filtered or unexported fields
}
SteppedTestKit is the testkit that can run stepped command
func NewSteppedTestKit ¶
func NewSteppedTestKit(t testing.TB, store kv.Storage) *SteppedTestKit
NewSteppedTestKit creates a new SteppedTestKit
func (*SteppedTestKit) Continue ¶
func (tk *SteppedTestKit) Continue() *SteppedTestKit
Continue continues current command
func (*SteppedTestKit) ExpectIdle ¶
func (tk *SteppedTestKit) ExpectIdle()
ExpectIdle checks no command is running
func (*SteppedTestKit) ExpectStopOnAnyBreakPoint ¶
func (tk *SteppedTestKit) ExpectStopOnAnyBreakPoint()
ExpectStopOnAnyBreakPoint checks stopped on any break point
func (*SteppedTestKit) ExpectStopOnBreakPoint ¶
func (tk *SteppedTestKit) ExpectStopOnBreakPoint(breakPoint string)
ExpectStopOnBreakPoint checks stopped on the specified break point
func (*SteppedTestKit) GetQueryResult ¶
func (tk *SteppedTestKit) GetQueryResult() *Result
GetQueryResult returns the query result of the latest command
func (*SteppedTestKit) GetResult ¶
func (tk *SteppedTestKit) GetResult() any
GetResult returns the result of the latest command
func (*SteppedTestKit) MustExec ¶
func (tk *SteppedTestKit) MustExec(sql string, args ...any)
MustExec executes a sql statement and asserts nil error.
func (*SteppedTestKit) MustQuery ¶
func (tk *SteppedTestKit) MustQuery(sql string, args ...any) *Result
MustQuery query the statements and returns result rows. If expected result is set it asserts the query result equals expected result.
func (*SteppedTestKit) SetBreakPoints ¶
func (tk *SteppedTestKit) SetBreakPoints(breakPoints ...string)
SetBreakPoints sets the break points we want to stop at
func (*SteppedTestKit) SteppedMustExec ¶
func (tk *SteppedTestKit) SteppedMustExec(sql string, args ...any) *SteppedTestKit
SteppedMustExec creates a new stepped task for MustExec
func (*SteppedTestKit) SteppedMustQuery ¶
func (tk *SteppedTestKit) SteppedMustQuery(sql string, args ...any) *SteppedTestKit
SteppedMustQuery creates a new stepped task for MustQuery
type TestKit ¶
type TestKit struct {
// contains filtered or unexported fields
}
TestKit is a utility to run sql test.
func NewTestKit ¶
NewTestKit returns a new *TestKit.
func NewTestKitWithSession ¶
NewTestKitWithSession returns a new *TestKit.
func (*TestKit) CheckExecResult ¶
CheckExecResult checks the affected rows and the insert id after executing MustExec.
func (*TestKit) CheckLastMessage ¶
CheckLastMessage checks last message after executing MustExec
func (*TestKit) EventuallyMustIndexLookup ¶
EventuallyMustIndexLookup checks whether the plan for the sql is IndexLookUp.
func (*TestKit) EventuallyMustQueryAndCheck ¶
func (tk *TestKit) EventuallyMustQueryAndCheck(sql string, args []any, expected [][]any, waitFor time.Duration, tick time.Duration)
EventuallyMustQueryAndCheck query the statements and assert that result rows.lt will equal the expected results in waitFor time, periodically checking equality each tick. Note: retry can't ignore error of the statements. If statements returns error, it will break out.
func (*TestKit) ExecWithContext ¶
func (tk *TestKit) ExecWithContext(ctx context.Context, sql string, args ...any) (rs sqlexec.RecordSet, err error)
ExecWithContext executes a sql statement using the prepared stmt API
func (*TestKit) HasKeywordInOperatorInfo ¶
HasKeywordInOperatorInfo checks if the result execution plan contains specific keyword in the operator info.
func (*TestKit) HasPlan4ExplainFor ¶
HasPlan4ExplainFor checks if the result execution plan contains specific plan.
func (*TestKit) HasPlanForLastExecution ¶
HasPlanForLastExecution checks if the execution plan of the last execution contains specific plan.
func (*TestKit) HasTiFlashPlan ¶
HasTiFlashPlan checks if the result execution plan contains TiFlash plan.
func (*TestKit) MustContainErrMsg ¶
MustContainErrMsg executes a sql statement and assert its error message containing errStr.
func (*TestKit) MustExecToErr ¶
MustExecToErr executes a sql statement and must return Error.
func (*TestKit) MustExecWithContext ¶
MustExecWithContext executes a sql statement and asserts nil error.
func (*TestKit) MustGetDBError ¶
MustGetDBError executes a sql statement and assert its terror.
func (*TestKit) MustGetErrCode ¶
MustGetErrCode executes a sql statement and assert it's error code.
func (*TestKit) MustGetErrMsg ¶
MustGetErrMsg executes a sql statement and assert its error message.
func (*TestKit) MustHavePlan ¶
MustHavePlan checks if the result execution plan contains specific plan.
func (*TestKit) MustIndexLookup ¶
MustIndexLookup checks whether the plan for the sql is IndexLookUp.
func (*TestKit) MustMatchErrMsg ¶
MustMatchErrMsg executes a sql statement and assert its error message matching errRx.
func (*TestKit) MustNoGlobalStats ¶
MustNoGlobalStats checks if there is no global stats.
func (*TestKit) MustNotHavePlan ¶
MustNotHavePlan checks if the result execution plan contains specific plan.
func (*TestKit) MustPartition ¶
MustPartition checks if the result execution plan must read specific partitions.
func (*TestKit) MustPartitionByList ¶
MustPartitionByList checks if the result execution plan must read specific partitions by list.
func (*TestKit) MustPointGet ¶
MustPointGet checks whether the plan for the sql is Point_Get.
func (*TestKit) MustQuery ¶
MustQuery query the statements and returns result rows. If expected result is set it asserts the query result equals expected result.
func (*TestKit) MustQueryWithContext ¶
MustQueryWithContext query the statements and returns result rows.
func (*TestKit) MustUseIndex ¶
MustUseIndex checks if the result execution plan contains specific index(es).
func (*TestKit) MustUseIndex4ExplainFor ¶
MustUseIndex4ExplainFor checks if the result execution plan contains specific index(es).
func (*TestKit) NotHasKeywordInOperatorInfo ¶
NotHasKeywordInOperatorInfo checks if the result execution plan doesn't contain specific keyword in the operator info.
func (*TestKit) QueryToErr ¶
QueryToErr executes a sql statement and discard results.
func (*TestKit) RefreshConnectionID ¶
func (tk *TestKit) RefreshConnectionID()
RefreshConnectionID refresh the connection ID for session of the testkit
func (*TestKit) RefreshSession ¶
func (tk *TestKit) RefreshSession()
RefreshSession set a new session for the testkit
func (*TestKit) RequireEqual ¶
RequireEqual checks if actual is equal to the expected
func (*TestKit) RequireNoError ¶
RequireNoError checks if error happens
func (*TestKit) RequireNotEqual ¶
RequireNotEqual checks if actual is not equal to the expected
func (*TestKit) ResultSetToResult ¶
ResultSetToResult converts sqlexec.RecordSet to testkit.Result. It is used to check results of execute statement in binary mode.
func (*TestKit) ResultSetToResultWithCtx ¶
func (tk *TestKit) ResultSetToResultWithCtx(ctx context.Context, rs sqlexec.RecordSet, comment string) *Result
ResultSetToResultWithCtx converts sqlexec.RecordSet to testkit.Result.
func (*TestKit) Session ¶
func (tk *TestKit) Session() sessiontypes.Session
Session return the session associated with the testkit
func (*TestKit) SetSession ¶
func (tk *TestKit) SetSession(session sessiontypes.Session)
SetSession set the session of testkit