testutils

package
v0.0.0-...-41663d2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestDomain = "ulmart.ru"
)

Variables

This section is empty.

Functions

func HandlePrometheusMetric

func HandlePrometheusMetric(t *testing.T, opts *HandlePrometheusMetricOpts)

HandlePrometheusMetric makes a request against configured Prometheus and compares received metrics against expected set.

func InitTestConfig

func InitTestConfig()

InitTestConfig initializes application configuration for tests.

func IsAccTestEnabled

func IsAccTestEnabled(t *testing.T) bool

IsAccTestEnabled checks if aceptance tests are enabled.

func PrepareDB

func PrepareDB(t *testing.T, conn *sqlx.DB)

func RespToJSON

func RespToJSON(t *testing.T, v interface{}) string

RespToJSON converts given type to JSON string.

func TeardownDB

func TeardownDB(t *testing.T, conn *sqlx.DB)

Types

type HandlePrometheusMetricOpts

type HandlePrometheusMetricOpts struct {
	Env      *PrometheusEnv
	Expected []*regexp.Regexp
}

HandlePrometheusMetricOpts contains options for the HandlePrometheusMetric.

type PrometheusEnv

type PrometheusEnv struct {
	Server *httptest.Server
}

PrometheusEnv represents a Prometheus testing environment.

func SetupPrometheus

func SetupPrometheus(collector prometheus.Collector) (*PrometheusEnv, error)

SetupPrometheus prepares a new Prometheus testing environment.

func (*PrometheusEnv) TearDown

func (p *PrometheusEnv) TearDown(collector prometheus.Collector)

TearDown releases the Prometheus testing environment.

Jump to

Keyboard shortcuts

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