Documentation
¶
Overview ¶
Package testutil provides shared test helpers used across sind packages.
Index ¶
- func ArgValue(args []string, flag string) (string, bool)
- func ArgValues(args []string, flag string) []string
- func ExitCode1(t *testing.T) *exec.ExitError
- func Image() string
- func NDJSON[T any](entries ...T) string
- func NewClient(t *testing.T) (*docker.Client, *mock.Recorder)
- func NoSuchContainer(name string) string
- func NoSuchNetwork(name string) string
- func NoSuchVolume(name string) string
- func Realm(string) string
- func TarArchive(name, content string) string
- func TarModes(t *testing.T, archive string) map[string]int64
- func WithoutCalls(events []progress.Event) string
- type PsEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitCode1 ¶
ExitCode1 returns an *exec.ExitError with exit code 1. This is used to mock Docker inspect commands that return exit code 1 for missing resources.
func Image ¶ added in v0.13.0
func Image() string
Image returns the sind-node image the tests run: SIND_TEST_IMAGE, or ghcr.io/gsi-hpc/sind-node:latest when it is unset.
func NoSuchContainer ¶ added in v0.10.0
NoSuchContainer returns what docker writes to stderr, with exit code 1, for a container that does not exist. Paired with ExitCode1 in a mock result, it gives the error the real executor returns, which docker.IsNotFound recognises.
func NoSuchNetwork ¶ added in v0.10.0
NoSuchNetwork is NoSuchContainer for a network.
func NoSuchVolume ¶ added in v0.10.0
NoSuchVolume is NoSuchContainer for a volume.
func Realm ¶
Realm returns the default realm "sind" in unit mode. In integration mode it returns a unique random realm with the given prefix.
func TarArchive ¶
TarArchive builds a tar archive containing a single file with the given name and content.
func TarModes ¶ added in v0.13.0
TarModes returns the mode of each file in a tar archive, as docker cp receives it on stdin.
func WithoutCalls ¶ added in v0.13.0
WithoutCalls draws the spans of events as progresstest.Capture.Tree does, leaving out the calls and what is under them: the docker commands, which the tests of the docker package cover, and of which a wait that polls runs as many as its rounds take.