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 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 Pairs(s []string) iter.Seq2[string, string]
- func Ptr[T any](v T) *T
- func Realm(string) string
- func TarArchive(name, content string) 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 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.