testhelp

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlwaysFails

func AlwaysFails(_ context.Context) error

AlwaysFails is a runFunc that always fails

func AlwaysFailsFallback

func AlwaysFailsFallback(_ context.Context, err error) error

AlwaysFailsFallback is a fallback circuit that always fails

func AlwaysPasses

func AlwaysPasses(_ context.Context) error

AlwaysPasses is a runFunc that always passes

func AlwaysPassesFallback

func AlwaysPassesFallback(_ context.Context, _ error) error

AlwaysPassesFallback is a fallback circuit that always passes

func DoTillTime

func DoTillTime(endTime time.Time, wg *sync.WaitGroup, f func())

DoTillTime concurrently calls f() in a forever loop until endTime

func MustNotTesting

func MustNotTesting(t *testing.T, err error)

MustNotTesting errors if err == nil

func MustTesting

func MustTesting(t *testing.T, err error)

MustTesting errors if err != nil

func SleepsForX

func SleepsForX(d time.Duration) func(context.Context) error

SleepsForX waits for a duration, or until the passed in context fails

Types

type BehaviorCheck

type BehaviorCheck struct {
	TotalRuns int64

	LongestRunDuration time.Duration
	MostConcurrent     int64

	RunFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

BehaviorCheck tracks Run commands to help you test their logic

func (*BehaviorCheck) Run

func (b *BehaviorCheck) Run(ctx context.Context) (err error)

Run is a runFunc. Use this as the runFunc for your circuit

Jump to

Keyboard shortcuts

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