Documentation
¶
Overview ¶
Package riverinternaltest contains shared testing utilities for tests throughout the rest of the project.
Index ¶
Constants ¶
const SchedulerShortInterval = 500 * time.Millisecond
SchedulerShortInterval is an artificially short interval for the scheduler that's used in the tests of various components to make sure that errored jobs always end up in a `retryable` state rather than `available`. Normally, the job executor sets `available` if the retry delay is smaller than the scheduler's interval. To simplify things so errors are always `retryable`, this time is picked to be smaller than any retry delay that the default retry policy will ever produce. It's shared so we can document/explain it all in one place.
Variables ¶
This section is empty.
Functions ¶
func DiscardContinuously ¶
func DiscardContinuously[T any](drainChan <-chan T) func()
DiscardContinuously drains continuously out of the given channel and discards anything that comes out of it. Returns a stop function that should be invoked to stop draining. Stop must be invoked before tests finish to stop an internal goroutine.
func DrainContinuously ¶
func DrainContinuously[T any](drainChan <-chan T) func() []T
DrainContinuously drains continuously out of the given channel and accumulates items that are received from it. Returns a get function that can be called to retrieve the current set of received items, and which will also cause the function to shut down and stop draining. This function must be invoked before tests finish to stop an internal goroutine. It's safe to call it multiple times.
func WrapTestMain ¶
WrapTestMain performs some common setup and teardown that should be shared amongst all packages. e.g. Checks for no goroutine leaks on teardown.
Types ¶
This section is empty.