testutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: GPL-3.0, LGPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil provides shared test helpers used across sind packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgValue

func ArgValue(args []string, flag string) (string, bool)

ArgValue returns the value following the first occurrence of flag in args.

func ArgValues

func ArgValues(args []string, flag string) []string

ArgValues returns all values following each occurrence of flag in args.

func ExitCode1

func ExitCode1(t *testing.T) *exec.ExitError

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 NDJSON

func NDJSON[T any](entries ...T) string

NDJSON builds newline-delimited JSON from the given entries.

func NewClient

func NewClient(t *testing.T) (*docker.Client, *mock.Recorder)

NewClient returns a docker.Client backed by a MockExecutor.

func Pairs

func Pairs(s []string) iter.Seq2[string, string]

Pairs yields adjacent pairs from a string slice.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to the given value.

func Realm

func Realm(string) string

Realm returns the default realm "sind" in unit mode. In integration mode it returns a unique random realm with the given prefix.

func TarArchive

func TarArchive(name, content string) string

TarArchive builds a tar archive containing a single file with the given name and content.

Types

type PsEntry

type PsEntry struct {
	ID     string `json:"ID"`
	Names  string `json:"Names"`
	State  string `json:"State"`
	Image  string `json:"Image"`
	Labels string `json:"Labels,omitempty"`
}

PsEntry mirrors the docker ps --format json output structure.

Jump to

Keyboard shortcuts

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