testutils

package
v0.0.0-test3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TEST_TIMEOUT = time.Minute * 15

Functions

func AssertAny

func AssertAny(t Tester, result interface{}, expected ...interface{})

func AssertEqual

func AssertEqual(t Tester, result, expected interface{})

func AssertInSlice

func AssertInSlice(t Tester, expected, slice interface{})

func GetCLIContext

func GetCLIContext(t *testing.T, args []string, flags map[string]interface{}) *cli.Context

func RunTest

func RunTest(t *testing.T, testCase TestCase)

func RunTests

func RunTests(t *testing.T, testCases []TestCase)

func WaitFor

func WaitFor(t Tester, interval, timeout time.Duration, conditionSatisfied func() bool)

Types

type ErrorGenerator

type ErrorGenerator struct {
	Index int
	// contains filtered or unexported fields
}

func (*ErrorGenerator) Error

func (e *ErrorGenerator) Error() error

func (*ErrorGenerator) Set

func (e *ErrorGenerator) Set(i int, err error)

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

Mock of Recorder interface

func NewRecorder

func NewRecorder(ctrl *gomock.Controller) *Recorder

func (*Recorder) Call

func (_m *Recorder) Call(_param0 string)

func (*Recorder) EXPECT

func (_m *Recorder) EXPECT() *_RecorderRecorder

type Reporter

type Reporter struct {
	T    *testing.T
	Name string
}

func NewReporter

func NewReporter(t *testing.T, name string) *Reporter

func (*Reporter) AssertAny

func (r *Reporter) AssertAny(result interface{}, expected ...interface{})

func (*Reporter) AssertEqual

func (r *Reporter) AssertEqual(result, expected interface{})

func (*Reporter) AssertEqualf

func (r *Reporter) AssertEqualf(result, expected interface{}, format string, args ...interface{})

func (*Reporter) AssertInSlice

func (r *Reporter) AssertInSlice(expected, slice interface{})

func (*Reporter) Error

func (r *Reporter) Error(err error)

func (*Reporter) Errorf

func (r *Reporter) Errorf(format string, args ...interface{})

func (*Reporter) Fatal

func (r *Reporter) Fatal(err error)

func (*Reporter) Fatalf

func (r *Reporter) Fatalf(format string, args ...interface{})

func (*Reporter) Log

func (r *Reporter) Log(str string)

func (*Reporter) Logf

func (r *Reporter) Logf(format string, args ...interface{})

type StubClock

type StubClock struct {
	Time time.Time
	// contains filtered or unexported fields
}

func (*StubClock) Now

func (s *StubClock) Now() time.Time

func (*StubClock) Since

func (s *StubClock) Since(t time.Time) time.Duration

func (*StubClock) Sleep

func (s *StubClock) Sleep(d time.Duration)

type TestCase

type TestCase struct {
	Name  string
	Setup func(*Reporter, *gomock.Controller) interface{}
	Run   func(*Reporter, interface{})
}

type Tester added in v0.10.4

type Tester interface {
	Fatal(tokens ...interface{})
	Fatalf(format string, tokens ...interface{})
}

Jump to

Keyboard shortcuts

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