testutil

package
v0.9.0 Latest Latest
Warning

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

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

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