Documentation ¶
Overview ¶
Package test provides shared test utils
Index ¶
- func GenPoints(num int) []*write.Point
- func GenRecords(num int) []string
- type HTTPService
- func (t *HTTPService) Authorization() string
- func (t *HTTPService) Close()
- func (t *HTTPService) DecodeLines(body io.Reader) error
- func (t *HTTPService) DoHTTPRequest(_ *http.Request, _ http2.RequestCallback, _ http2.ResponseCallback) *http2.Error
- func (t *HTTPService) DoHTTPRequestWithResponse(_ *http.Request, _ http2.RequestCallback) (*http.Response, error)
- func (t *HTTPService) DoPostRequest(_ context.Context, url string, body io.Reader, ...) *http2.Error
- func (t *HTTPService) GetRequest(_ context.Context, _ string, _ http2.RequestCallback, _ http2.ResponseCallback) *http2.Error
- func (t *HTTPService) HTTPClient() *http.Client
- func (t *HTTPService) Lines() []string
- func (t *HTTPService) ReplyError() *http2.Error
- func (t *HTTPService) Requests() int
- func (t *HTTPService) ServerAPIURL() string
- func (t *HTTPService) ServerURL() string
- func (t *HTTPService) SetAuthorization(_ string)
- func (t *HTTPService) SetReplyError(replyError *http2.Error)
- func (t *HTTPService) SetRequestHandler(fn func(url string, body io.Reader) error)
- func (t *HTTPService) SetWasGzip(wasGzip bool)
- func (t *HTTPService) WasGzip() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPService ¶
type HTTPService struct {
// contains filtered or unexported fields
}
HTTPService is http.Service implementation for tests
func NewTestService ¶
func NewTestService(t *testing.T, serverURL string) *HTTPService
NewTestService creates new test HTTP service
func (*HTTPService) Authorization ¶
func (t *HTTPService) Authorization() string
Authorization returns current authorization header value
func (*HTTPService) DecodeLines ¶ added in v2.9.2
func (t *HTTPService) DecodeLines(body io.Reader) error
DecodeLines parses request body for lines
func (*HTTPService) DoHTTPRequest ¶
func (t *HTTPService) DoHTTPRequest(_ *http.Request, _ http2.RequestCallback, _ http2.ResponseCallback) *http2.Error
DoHTTPRequest does nothing for this service
func (*HTTPService) DoHTTPRequestWithResponse ¶
func (t *HTTPService) DoHTTPRequestWithResponse(_ *http.Request, _ http2.RequestCallback) (*http.Response, error)
DoHTTPRequestWithResponse does nothing for this service
func (*HTTPService) DoPostRequest ¶
func (t *HTTPService) DoPostRequest(_ context.Context, url string, body io.Reader, requestCallback http2.RequestCallback, _ http2.ResponseCallback) *http2.Error
DoPostRequest reads http request, validates URL and stores data in the request
func (*HTTPService) GetRequest ¶
func (t *HTTPService) GetRequest(_ context.Context, _ string, _ http2.RequestCallback, _ http2.ResponseCallback) *http2.Error
GetRequest does nothing for this service
func (*HTTPService) HTTPClient ¶
func (t *HTTPService) HTTPClient() *http.Client
HTTPClient returns nil for this service
func (*HTTPService) Lines ¶
func (t *HTTPService) Lines() []string
Lines returns decoded lines from request
func (*HTTPService) ReplyError ¶
func (t *HTTPService) ReplyError() *http2.Error
ReplyError returns current reply error
func (*HTTPService) Requests ¶ added in v2.10.0
func (t *HTTPService) Requests() int
Requests returns number of requests
func (*HTTPService) ServerAPIURL ¶
func (t *HTTPService) ServerAPIURL() string
ServerAPIURL returns testing URL
func (*HTTPService) ServerURL ¶
func (t *HTTPService) ServerURL() string
ServerURL returns testing URL
func (*HTTPService) SetAuthorization ¶
func (t *HTTPService) SetAuthorization(_ string)
SetAuthorization sets authorization string
func (*HTTPService) SetReplyError ¶
func (t *HTTPService) SetReplyError(replyError *http2.Error)
SetReplyError sets Error that will be returned as a response
func (*HTTPService) SetRequestHandler ¶ added in v2.9.2
func (t *HTTPService) SetRequestHandler(fn func(url string, body io.Reader) error)
SetRequestHandler sets custom handler for requests
func (*HTTPService) SetWasGzip ¶
func (t *HTTPService) SetWasGzip(wasGzip bool)
SetWasGzip sets wasGzip flag
func (*HTTPService) WasGzip ¶
func (t *HTTPService) WasGzip() bool
WasGzip returns true of request was in GZip format