Help us shape the future of Go! Take the 2026 Go Developer Survey

dockertest

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package dockertest decides whether a test that needs a Linux docker daemon runs, skips or fails on the current host (D-0286).

A test that starts containers calls Require first. On a GitHub Actions Linux runner docker ships in the image, so an unusable daemon there is a broken runner and the test fails. Everywhere else (a laptop with Colima stopped, the cam CI host whose cam-ci user cannot open the socket, macOS and Windows runners) an unusable daemon skips the test with the reason.

Layer: L0. Imports the standard library only. Lives under internal/docker so its `docker info` probe stays inside the docker funnel (repoqa TestDockerFunnel).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Require

func Require(t testing.TB)

Require skips t when no usable Linux docker daemon is reachable, and fails t instead when Strict reports a GitHub Actions Linux runner. It returns only when `docker info` answers with a Linux daemon.

func RuntimeFailure added in v1.4.15

func RuntimeFailure(t testing.TB, err error, stderr string) bool

RuntimeFailure is for a test whose `docker run` itself failed. When the error text shows the host cannot start containers it skips t (or fails on a GitHub Linux runner, like Require, and under INTEGRATION=1) and returns true; otherwise it returns false and the caller reports the failure as a real one. Matching is case-insensitive.

func Strict

func Strict(goos, githubActions string) bool

Strict reports whether an unusable docker must fail rather than skip: only on a GitHub Actions Linux runner (GITHUB_ACTIONS=true, the exact value GitHub sets). CI alone is not enough: the cam CI host sets CI=1 for a user without socket access.

Types

This section is empty.

Jump to

Keyboard shortcuts

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