Documentation ¶
Overview ¶
Package testing provides functionality for use when conducting tests
Index ¶
- Constants
- Variables
- func BasicHTTPHandler(w http.ResponseWriter, r *http.Request)
- func NewTestInstance(configFile string, defaultPathConfigs func(*bo.Options) map[string]*po.Options, ...) (*httptest.Server, *httptest.ResponseRecorder, *http.Request, *http.Client, ...)
- func NewTestPathConfig(o *bo.Options, defaultPathConfigs func(*bo.Options) map[string]*po.Options, ...) *po.Options
- func NewTestRewriteInstructions() rewriter.RewriteInstructions
- func NewTestServer(responseCode int, responseBody string, headers map[string]string) *httptest.Server
- func NewTestTracer() *tracing.Tracer
- func NewTestWebClient() *http.Client
Constants ¶
const Epoch2020 int64 = 1577836800
Epoch2020 is the epoch value representing 1 January 2020 00:00:00 UTC
Variables ¶
var ErrTest = errors.New("test error")
ErrTest is a Test Error
var Time2020 = time.Unix(Epoch2020, 0)
Time2020 is the Time.Time representing 1 January 2020 00:00:00 UTC
Functions ¶
func BasicHTTPHandler ¶
func BasicHTTPHandler(w http.ResponseWriter, r *http.Request)
BasicHTTPHandler is a basic HTTP Handler for use in unit e
func NewTestInstance ¶
func NewTestInstance( configFile string, defaultPathConfigs func(*bo.Options) map[string]*po.Options, respCode int, respBody string, respHeaders map[string]string, backendProvider, urlPath, logLevel string, ) (*httptest.Server, *httptest.ResponseRecorder, *http.Request, *http.Client, error)
NewTestInstance will start a trickster
func NewTestPathConfig ¶
func NewTestPathConfig( o *bo.Options, defaultPathConfigs func(*bo.Options) map[string]*po.Options, urlPath string, ) *po.Options
NewTestPathConfig returns a path config based on the provided parameters
func NewTestRewriteInstructions ¶
func NewTestRewriteInstructions() rewriter.RewriteInstructions
NewTestRewriterInstructions returns a set of example Rewriter Instructions for use in unit testing
func NewTestServer ¶
func NewTestServer(responseCode int, responseBody string, headers map[string]string) *httptest.Server
NewTestServer returns a new httptest.Server that responds with the provided code, body and headers
func NewTestTracer ¶
NewTestTracer returns a standard out tracer for testing purposes
func NewTestWebClient ¶
NewTestWebClient returns a new *http.Client configured with reasonable defaults
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
timeseries
|
|
model
Package model is a test utility package that serializes between a *DataSet and the Prometheus HTTP API JSON Format
|
Package model is a test utility package that serializes between a *DataSet and the Prometheus HTTP API JSON Format |
Package tls provides functionality for use when conducting tests with TLS
|
Package tls provides functionality for use when conducting tests with TLS |
package writer represents a Test ResponseWriter for use in Unit Tests
|
package writer represents a Test ResponseWriter for use in Unit Tests |