testutil

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PollUntil

func PollUntil(t testing.TB, check func() bool, deadline time.Duration)

PollUntil calls check() repeatedly until it returns true or deadline elapses. Fails the test immediately if the deadline expires without check() returning true.

func ReadyExtension

func ReadyExtension() (registry.Extension, <-chan struct{})

ReadyExtension creates an extension that registers a `test-ready!` primitive. When Scheme code calls `(test-ready!)`, it closes the returned channel exactly once, providing a deterministic "code is running" signal to Go test code.

Each call returns a fresh extension and channel. Do not reuse across subtests -- create a new ReadyExtension per subtest to get a fresh channel.

func StableGoroutineCount added in v1.20.0

func StableGoroutineCount(t testing.TB, deadline time.Duration) int

StableGoroutineCount polls runtime.NumGoroutine() until two consecutive reads return the same value, or the deadline elapses. Logs a warning if stability is not achieved.

The count is process-wide, so it corroborates a leak claim rather than proving one: an unrelated goroutine starting or exiting during the poll moves it too. Assert on the resource's own state (a thread's ThreadState, a process's ProcessState) and use this only as a second signal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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