testing

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveScenario

type ActiveScenario struct {
	Stages []Stage
	Name   string
	// contains filtered or unexported fields
}

func NewActiveScenario added in v1.0.21

func NewActiveScenario(name string, fn MultiStageSetupFn) (*ActiveScenario, bool)

func (*ActiveScenario) RecordDroppedIteration

func (s *ActiveScenario) RecordDroppedIteration()

func (*ActiveScenario) Run

func (s *ActiveScenario) Run(metric metrics.MetricType, stage, iter string, f func(t *T)) bool

Run performs a single iteration of the test. It returns `true` if the test was successful, `false` otherwise.

func (*ActiveScenario) Teardown added in v1.0.21

func (s *ActiveScenario) Teardown()

type CancellableTimer

type CancellableTimer struct {
	C chan bool
	// contains filtered or unexported fields
}

func NewCancellableTimer

func NewCancellableTimer(d time.Duration) *CancellableTimer

func (*CancellableTimer) Cancel

func (c *CancellableTimer) Cancel() bool

Cancel makes all the waiters receive false

func (*CancellableTimer) Reset

func (c *CancellableTimer) Reset(duration time.Duration)

type MultiStageSetupFn

type MultiStageSetupFn func(t *T) []Stage

type RunFn

type RunFn func(t *T)

RunFn performs a single iteration of the test. It may be used for asserting results or failing the test.

type ScenarioFn added in v1.0.21

type ScenarioFn func(t *T) RunFn

ScenarioFn initialises a scenario and returns the iteration function (RunFn) to be invoked for every iteration of the tests.

type Stage

type Stage struct {
	Name  string
	RunFn RunFn
}

type T

type T struct {
	// "iteration " + iteration number or "setup"
	Iteration string
	// Logger with user and iteration tags
	Log *log.Logger

	Require  *require.Assertions
	Scenario string
	// contains filtered or unexported fields
}

func NewT

func NewT(iter, scenarioName string) *T

func (*T) Cleanup added in v1.0.21

func (t *T) Cleanup(f func())

Cleanup registers a teardown function to be called when T has completed

func (*T) Errorf

func (t *T) Errorf(format string, args ...interface{})

func (*T) Fail

func (t *T) Fail()

func (*T) FailNow

func (t *T) FailNow()

func (*T) FailWithError added in v1.0.17

func (t *T) FailWithError(err error)

func (*T) HasFailed

func (t *T) HasFailed() bool

func (*T) Time

func (t *T) Time(stageName string, f func())

Time records a metric for the duration of the given function

Jump to

Keyboard shortcuts

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