testutil

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nerdctl = Target("nerdctl")
	Docker  = Target("docker")
)
View Source
const (
	FedoraESGZImage = "ghcr.io/stargz-containers/fedora:30-esgz" // eStargz
)
View Source
const Namespace = "nerdctl-test"

Variables

View Source
var (
	AlpineImage                 = mirrorOf("alpine:3.13")
	NginxAlpineImage            = mirrorOf("nginx:1.19-alpine")
	NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>"
	RegistryImage               = mirrorOf("registry:2")
	WordpressImage              = mirrorOf("wordpress:5.7")
	WordpressIndexHTMLSnippet   = "<title>WordPress &rsaquo; Installation</title>"
	MariaDBImage                = mirrorOf("mariadb:10.5")
	GolangImage                 = mirrorOf("golang:1.18")
	DockerAuthImage             = mirrorOf("cesanta/docker_auth:1.7")
	FluentdImage                = mirrorOf("fluent/fluentd:v1.14-1")

	// Source: https://gist.github.com/cpuguy83/fcf3041e5d8fb1bb5c340915aabeebe0
	NonDistBlobImage = "ghcr.io/cpuguy83/non-dist-blob:latest"
	// Foreign layer digest
	NonDistBlobDigest = "sha256:be691b1535726014cdf3b715ff39361b19e121ca34498a9ceea61ad776b9c215"

	CommonImage = AlpineImage
)

Functions

func DockerIncompatible

func DockerIncompatible(t testing.TB)

func GetDaemonIsKillable

func GetDaemonIsKillable() bool

func GetTarget

func GetTarget() string

func Identifier added in v0.16.0

func Identifier(t testing.TB) string

Identifier can be used as a name of container, image, volume, network, etc.

func M

func M(m *testing.M)

func RequireContainerdPlugin added in v0.20.0

func RequireContainerdPlugin(base *Base, requiredType, requiredID string, requiredCaps []string)

func RequireDaemonVersion added in v0.20.0

func RequireDaemonVersion(b *Base, constraint string)

func RequireExecPlatform added in v0.13.0

func RequireExecPlatform(t testing.TB, ss ...string)

func RequiresBuild

func RequiresBuild(t testing.TB)

func WithStdin added in v0.13.0

func WithStdin(r io.Reader) func(*Cmd)

WithStdin sets the standard input of Cmd to the specified reader

Types

type Base

type Base struct {
	T                testing.TB
	Target           Target
	DaemonIsKillable bool
	Binary           string
	ComposeBinary    string // "docker-compose"
	Args             []string
	Env              []string
}

func NewBase

func NewBase(t *testing.T) *Base

func (*Base) Cmd

func (b *Base) Cmd(args ...string) *Cmd

func (*Base) CmdWithHelper

func (b *Base) CmdWithHelper(helper []string, args ...string) *Cmd

func (*Base) ComposeCmd added in v0.8.0

func (b *Base) ComposeCmd(args ...string) *Cmd

ComposeCmd executes `nerdctl -n nerdctl-test compose` or `docker-compose`

func (*Base) DumpDaemonLogs added in v0.15.0

func (b *Base) DumpDaemonLogs(minutes int)

func (*Base) EnsureDaemonActive

func (b *Base) EnsureDaemonActive()

func (*Base) Info added in v0.7.3

func (b *Base) Info() dockercompat.Info

func (*Base) InfoNative added in v0.20.0

func (b *Base) InfoNative() native.Info

func (*Base) InspectContainer

func (b *Base) InspectContainer(name string) dockercompat.Container

func (*Base) InspectImage added in v0.9.0

func (b *Base) InspectImage(name string) dockercompat.Image

func (*Base) InspectNetwork added in v0.11.0

func (b *Base) InspectNetwork(name string) dockercompat.Network

func (*Base) InspectVolume added in v0.11.0

func (b *Base) InspectVolume(name string) native.Volume

func (*Base) KillDaemon

func (b *Base) KillDaemon()

type Cmd

type Cmd struct {
	icmd.Cmd
	*Base
}

func (*Cmd) Assert

func (c *Cmd) Assert(expected icmd.Expected)

func (*Cmd) AssertCombinedOutContains added in v0.18.0

func (c *Cmd) AssertCombinedOutContains(s string)

func (*Cmd) AssertExitCode

func (c *Cmd) AssertExitCode(exitCode int)

func (*Cmd) AssertFail

func (c *Cmd) AssertFail()

func (*Cmd) AssertNoOut

func (c *Cmd) AssertNoOut(s string)

func (*Cmd) AssertOK

func (c *Cmd) AssertOK()

func (*Cmd) AssertOutContains added in v0.8.1

func (c *Cmd) AssertOutContains(s string)

func (*Cmd) AssertOutExactly added in v0.13.0

func (c *Cmd) AssertOutExactly(s string)

func (*Cmd) AssertOutNotContains added in v0.16.1

func (c *Cmd) AssertOutNotContains(s string)

func (*Cmd) AssertOutWithFunc

func (c *Cmd) AssertOutWithFunc(fn func(stdout string) error)

func (*Cmd) CmdOption added in v0.13.0

func (c *Cmd) CmdOption(cmdOptions ...func(*Cmd)) *Cmd

func (*Cmd) Out added in v0.13.0

func (c *Cmd) Out() string

func (*Cmd) OutLines added in v0.13.0

func (c *Cmd) OutLines() []string

func (*Cmd) Run

func (c *Cmd) Run() *icmd.Result

type ComposeDir added in v0.8.0

type ComposeDir struct {
	// contains filtered or unexported fields
}

func NewComposeDir added in v0.8.0

func NewComposeDir(t testing.TB, dockerComposeYAML string) *ComposeDir

func (*ComposeDir) CleanUp added in v0.8.0

func (cd *ComposeDir) CleanUp()

func (*ComposeDir) Dir added in v0.17.0

func (cd *ComposeDir) Dir() string

func (*ComposeDir) ProjectName added in v0.8.0

func (cd *ComposeDir) ProjectName() string

func (*ComposeDir) WriteFile added in v0.8.0

func (cd *ComposeDir) WriteFile(name, content string)

func (*ComposeDir) YAMLFullPath added in v0.8.0

func (cd *ComposeDir) YAMLFullPath() string

type Target

type Target = string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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