testing

package
v2.0.0-beta2.0...-3469a79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package testing provides functionality for use when conducting tests

Index

Constants

View Source
const Epoch2020 int64 = 1577836800

Epoch2020 is the epoch value representing 1 January 2020 00:00:00 UTC

Variables

View Source
var ErrTest = errors.New("test error")

ErrTest is a Test Error

View Source
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

func NewTestTracer() *tracing.Tracer

NewTestTracer returns a standard out tracer for testing purposes

func NewTestWebClient

func NewTestWebClient() *http.Client

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL