Documentation
¶
Index ¶
- Variables
- func CheckDelete(client *http.Client, url string, checkOpts ...func([]byte, int, http.Header)) error
- func CheckGetJSON(client *http.Client, url string, data []byte, ...) error
- func CheckGetUntilStatusCode(re *require.Assertions, client *http.Client, url string, code int) error
- func CheckPatchJSON(client *http.Client, url string, data []byte, ...) error
- func CheckPostJSON(client *http.Client, url string, data []byte, ...) error
- func CleanServer(dataDir string)
- func Eventually(re *require.Assertions, condition func() bool, opts ...WaitOption)
- func ExtractJSON(re *require.Assertions, data any) func([]byte, int, http.Header)
- func GenerateTestDataConcurrently(count int, f func(int))
- func InitTempFileLogger(level string) (fname string)
- 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 any, ...) error
- func ReadGetJSONWithBody(re *require.Assertions, client *http.Client, url string, input []byte, ...) error
- func Status(re *require.Assertions, code int) func([]byte, int, http.Header)
- func StatusNotOK(re *require.Assertions) func([]byte, int, http.Header)
- func StatusOK(re *require.Assertions) func([]byte, int, http.Header)
- func StringContain(re *require.Assertions, sub string) func([]byte, int, http.Header)
- func StringEqual(re *require.Assertions, str string) func([]byte, int, http.Header)
- func StringNotContain(re *require.Assertions, sub string) func([]byte, int, http.Header)
- func WithHeader(re *require.Assertions, key, value string) func([]byte, int, http.Header)
- func WithoutHeader(re *require.Assertions, key string) func([]byte, int, http.Header)
- 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("google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run"), 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 CheckDelete ¶
func CheckDelete(client *http.Client, url string, checkOpts ...func([]byte, int, http.Header)) error
CheckDelete is used to do delete request and do check options.
func CheckGetJSON ¶
func CheckGetJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int, http.Header)) error
CheckGetJSON is used to do get request and do check options.
func CheckGetUntilStatusCode ¶
func CheckGetUntilStatusCode(re *require.Assertions, client *http.Client, url string, code int) error
CheckGetUntilStatusCode 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, http.Header)) 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, http.Header)) 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 ¶
ExtractJSON is used to check whether given data can be extracted successfully.
func GenerateTestDataConcurrently ¶
GenerateTestDataConcurrently generates test data concurrently.
func InitTempFileLogger ¶
InitTempFileLogger initializes the logger and redirects the log output to a temporary file.
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 ¶
func ReadGetJSON(re *require.Assertions, client *http.Client, url string, data any, checkOpts ...func([]byte, int, http.Header)) error
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 any, checkOpts ...func([]byte, int, http.Header)) error
ReadGetJSONWithBody is used to do get request with input and check whether given data can be extracted successfully.
func StatusNotOK ¶
StatusNotOK is used to check whether http response code is not equal http.StatusOK.
func StringContain ¶
StringContain is used to check whether response context contains given string.
func StringEqual ¶
StringEqual is used to check whether response context equal given string.
func StringNotContain ¶
StringNotContain is used to check whether response context doesn't contain given string.
func WithHeader ¶
WithHeader is used to check whether response header contains given key and value.
func WithoutHeader ¶
WithoutHeader is used to check whether response header does not contain given key.
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.