tests

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClockFromContext

func ClockFromContext(ctx context.Context) clockwork.FakeClock

ClockFromContext returns clock or panics.

func ConfigureTracer

func ConfigureTracer(m *testing.M)

ConfigureTracer starts the tracer.

func FilterInteraction

func FilterInteraction(i *cassette.Interaction) error

FilterInteraction removes secret arguments from the URL.

func IsCIRun

func IsCIRun() bool

IsCIRun returns true if the CI environment variable is set to "true"

func MatchInteraction

func MatchInteraction(r *http.Request, i cassette.Request) bool

MatchInteraction checks if the request matches a store request in the given cassette.

func ReadFixture

func ReadFixture(path string) (string, error)

ReadFixture opens the file at path and returns the contents as a string

func Recorder

func Recorder(ctx context.Context, t *testing.T) (*recorder.Recorder, error)

Recorder intercepts HTTP requests.

func RestoreClock

func RestoreClock(t *testing.T) clockwork.FakeClock

RestoreClock restore current time from .freeze file.

func Retry

func Retry(interval time.Duration, count int, call func() bool) error

Retry calls the call function for count times every interval while it returns false

func SetClock

func SetClock(t *testing.T) clockwork.FakeClock

SetClock stores current time in .freeze file.

func UniqueEntityName

func UniqueEntityName(ctx context.Context, t *testing.T) *string

UniqueEntityName will return a unique string that can be used as a title/description/summary/... of an API entity. When used in Azure Pipelines and RECORD=true or RECORD=none, it will include BuildId to enable mapping resources that weren't deleted to builds.

func WithClock

func WithClock(ctx context.Context, t *testing.T) context.Context

WithClock sets clock to context.

func WithTestSpan

func WithTestSpan(ctx context.Context, t *testing.T) (context.Context, func())

WithTestSpan starts new span with test information.

func WrapRoundTripper

func WrapRoundTripper(rt http.RoundTripper, opts ...ddhttp.RoundTripperOption) http.RoundTripper

WrapRoundTripper includes tracing information.

Types

type Assertions

type Assertions struct {
	require.Assertions
}

Assertions wrapper

func Assert

func Assert(ctx context.Context, t *testing.T) *Assertions

Assert wraps context and testing object.

type RecordingMode

type RecordingMode string

RecordingMode defines valid usage of cassette recorder

const (
	ModeIgnore    RecordingMode = "none"
	ModeReplaying RecordingMode = "false"
	ModeRecording RecordingMode = "true"
)

Valid usage modes for cassette recorder

func GetRecording

func GetRecording() RecordingMode

GetRecording returns the value of RECORD environment variable

type TestingT

type TestingT struct {
	*testing.T
	// contains filtered or unexported fields
}

TestingT keeps track of a context.

func (*TestingT) Errorf

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

Errorf format error message.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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