assert

package
v0.0.0-...-100cc6e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelHasItem

func ChannelHasItem[T any](t test.Failer, c <-chan T) T

ChannelHasItem asserts a channel has an element within 5s and returns the element

func ChannelIsClosed

func ChannelIsClosed[T any](t test.Failer, c <-chan T)

ChannelIsClosed asserts a channel is closed

func ChannelIsEmpty

func ChannelIsEmpty[T any](t test.Failer, c <-chan T)

ChannelIsEmpty asserts a channel is empty for at least 20ms

func Compare

func Compare[T any](a, b T) error

Compare compares two objects and returns and error if they are not the same.

func Equal

func Equal[T any](t test.Failer, a, b T, context ...string)

Equal compares two objects and fails if they are not the same.

func Error

func Error(t test.Failer, err error)

Error asserts the provided err is non-nil

func EventuallyEqual

func EventuallyEqual[T any](t test.Failer, fetch func() T, expected T, retryOpts ...retry.Option)

EventuallyEqual compares repeatedly calls the fetch function until the result matches the expectation.

func NoError

func NoError(t test.Failer, err error)

NoError asserts the provided err is nil

Types

type Tracker

type Tracker[T comparable] struct {
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker[T comparable](t test.Failer) *Tracker[T]

NewTracker builds a tracker which records events that occur

func (*Tracker[T]) Empty

func (t *Tracker[T]) Empty()

Empty asserts the tracker is empty

func (*Tracker[T]) Events

func (t *Tracker[T]) Events() []T

func (*Tracker[T]) Record

func (t *Tracker[T]) Record(event T)

Record that an event occurred.

func (*Tracker[T]) WaitCompare

func (t *Tracker[T]) WaitCompare(f func(T) bool)

WaitCompare waits for an event to happen and ensures it meets a custom comparison function

func (*Tracker[T]) WaitOrdered

func (t *Tracker[T]) WaitOrdered(events ...T)

WaitOrdered waits for an event to happen, in order

func (*Tracker[T]) WaitUnordered

func (t *Tracker[T]) WaitUnordered(events ...T)

WaitUnordered waits for an event to happen, in any order

Jump to

Keyboard shortcuts

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