Documentation ¶
Index ¶
- Variables
- func CheckGetJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
- func CheckPatchJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
- func CheckPostJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
- func CleanServer(dataDir string)
- func Eventually(re *require.Assertions, condition func() bool, opts ...WaitOption)
- func ExtractJSON(re *require.Assertions, data interface{}) func([]byte, int)
- func MustNewGrpcClient(re *require.Assertions, addr string) pdpb.PDClient
- func NewRequestHeader(clusterID uint64) *pdpb.RequestHeader
- func ReadGetJSON(re *require.Assertions, client *http.Client, url string, data interface{}) error
- func ReadGetJSONWithBody(re *require.Assertions, client *http.Client, url string, input []byte, ...) error
- func Status(re *require.Assertions, code int) func([]byte, int)
- func StatusNotOK(re *require.Assertions) func([]byte, int)
- func StatusOK(re *require.Assertions) func([]byte, int)
- func StringContain(re *require.Assertions, sub string) func([]byte, int)
- func StringEqual(re *require.Assertions, str string) func([]byte, int)
- type CleanupFunc
- type WaitOp
- type WaitOption
Constants ¶
This section is empty.
Variables ¶
var LeakOptions = []goleak.Option{ goleak.IgnoreTopFunction("github.com/syndtr/goleveldb/leveldb.(*DB).mpoolDrain"), goleak.IgnoreTopFunction("google.golang.org/grpc.(*ccBalancerWrapper).watcher"), goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransport"), goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("sync.runtime_notifyListWait"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), }
LeakOptions is used to filter the goroutines.
Functions ¶
func CheckGetJSON ¶
func CheckGetJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
CheckGetJSON is used to do get request and do check options
func CheckPatchJSON ¶
func CheckPatchJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
CheckPatchJSON is used to do patch request and do check options
func CheckPostJSON ¶
func CheckPostJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int)) error
CheckPostJSON is used to do post request and do check options
func Eventually ¶
func Eventually(re *require.Assertions, condition func() bool, opts ...WaitOption)
Eventually asserts that given condition will be met in a period of time.
func ExtractJSON ¶
func ExtractJSON(re *require.Assertions, data interface{}) func([]byte, int)
ExtractJSON is used to check whether given data can be extracted successfully
func MustNewGrpcClient ¶
func MustNewGrpcClient(re *require.Assertions, addr string) pdpb.PDClient
MustNewGrpcClient must create a new PD grpc client.
func NewRequestHeader ¶
func NewRequestHeader(clusterID uint64) *pdpb.RequestHeader
NewRequestHeader creates a new request header.
func ReadGetJSON ¶
ReadGetJSON is used to do get request and check whether given data can be extracted successfully
func ReadGetJSONWithBody ¶
func ReadGetJSONWithBody(re *require.Assertions, client *http.Client, url string, input []byte, data interface{}) error
ReadGetJSONWithBody is used to do get request with input and check whether given data can be extracted successfully
func Status ¶
func Status(re *require.Assertions, code int) func([]byte, int)
Status is used to check whether http response code is equal given code
func StatusNotOK ¶
func StatusNotOK(re *require.Assertions) func([]byte, int)
StatusNotOK is used to check whether http response code is not equal http.StatusOK
func StatusOK ¶
func StatusOK(re *require.Assertions) func([]byte, int)
StatusOK is used to check whether http response code is equal http.StatusOK
func StringContain ¶
func StringContain(re *require.Assertions, sub string) func([]byte, int)
StringContain is used to check whether response context contains given string
func StringEqual ¶
func StringEqual(re *require.Assertions, str string) func([]byte, int)
StringEqual is used to check whether response context equal given string
Types ¶
type CleanupFunc ¶
type CleanupFunc func()
CleanupFunc closes test pd server(s) and deletes any files left behind.
type WaitOp ¶
type WaitOp struct {
// contains filtered or unexported fields
}
WaitOp represents available options when execute Eventually.
type WaitOption ¶
type WaitOption func(op *WaitOp)
WaitOption configures WaitOp.
func WithTickInterval ¶
func WithTickInterval(tickInterval time.Duration) WaitOption
WithTickInterval specify the tick interval to check the condition.
func WithWaitFor ¶
func WithWaitFor(waitFor time.Duration) WaitOption
WithWaitFor specify the max wait duration.