testdocker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package testdocker is a test's docker half of the setup: whether a daemon is reachable, and a tree in a volume. A package rather than a _test.go file because seven packages carried their own copies.

Index

Constants

View Source
const TreePath = "/steps/work"

TreePath is where Tree mounts the volume. Any container path serves; a step's own is shell.BuildDir, GetDir or PutDir.

Variables

This section is empty.

Functions

func ReadTree added in v0.4.0

func ReadTree(t testing.TB, tree TreeVolume, rel string) ([]byte, fs.FileMode, error)

ReadTree is rel's bytes and mode as the volume holds them: what a step's fetch would bring home.

func Require

func Require(t testing.TB)

Require skips the calling test unless a usable daemon is reachable. Not opt-in: a test guarding a shipped feature does not get to be optional, and one that was is how a containerized placed step shipped not working. A test that needs a tree in its container seeds a volume with Tree.

Types

type TreeVolume added in v0.4.0

type TreeVolume struct {
	Volumes []dockerapi.Bind
}

TreeVolume is a seeded tree: Volumes goes in a RunnerSpec beside MountPath: TreePath. A struct so a package depguard keeps off dockerapi can hold one.

func Tree added in v0.4.0

func Tree(t testing.TB, dir string) TreeVolume

Tree copies dir into a fresh volume. Symlinks and modes are carried as they are, so a test of what a link may reach still plants one on the host.

Jump to

Keyboard shortcuts

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