Documentation
¶
Index ¶
- Constants
- Variables
- func DockerIncompatible(t testing.TB)
- func GetAllowModifyUsers() bool
- func GetDaemonIsKillable() bool
- func GetEnableIPv6() bool
- func GetEnableKubernetes() bool
- func GetFlakyEnvironment() bool
- func GetTarget() string
- func Identifier(t testing.TB) string
- func ImageRepo(s string) string
- func IsDocker() bool
- func LoadProject(fileName, projectName string, envMap map[string]string) (*compose.Project, error)
- func M(m *testing.M)
- func RegisterBuildCacheCleanup(t *testing.T)
- func RequireContainerdPlugin(base *Base, requiredType, requiredID string, requiredCaps []string)
- func RequireExecPlatform(t testing.TB, ss ...string)
- func RequireExecutable(t testing.TB, name string)
- func RequireKernelVersion(t testing.TB, constraint string)
- func RequireSystemService(t testing.TB, sv string)
- func RequiresBuild(t testing.TB)
- func WithStdin(r io.Reader) func(*Cmd)
- type Base
- func (b *Base) Cmd(args ...string) *Cmd
- func (b *Base) CmdWithHelper(helper []string, args ...string) *Cmd
- func (b *Base) ComposeCmd(args ...string) *Cmd
- func (b *Base) ComposeCmdWithHelper(helper []string, args ...string) *Cmd
- func (b *Base) ContainerdAddress() string
- func (b *Base) DumpDaemonLogs(minutes int)
- func (b *Base) EnsureContainerExited(con string, expectedExitCode int)
- func (b *Base) EnsureContainerStarted(con string)
- func (b *Base) EnsureDaemonActive()
- func (b *Base) Info() dockercompat.Info
- func (b *Base) InfoNative() native.Info
- func (b *Base) InspectContainer(name string) dockercompat.Container
- func (b *Base) InspectImage(name string) dockercompat.Image
- func (b *Base) InspectNetwork(name string) dockercompat.Network
- func (b *Base) InspectVolume(name string, args ...string) native.Volume
- func (b *Base) KillDaemon()
- type Cmd
- func (c *Cmd) Assert(expected icmd.Expected)
- func (c *Cmd) AssertCombinedOutContains(s string)
- func (c *Cmd) AssertExitCode(exitCode int)
- func (c *Cmd) AssertFail()
- func (c *Cmd) AssertOK()
- func (c *Cmd) AssertOutContains(s string)
- func (c *Cmd) AssertOutContainsAll(strs ...string)
- func (c *Cmd) AssertOutContainsAny(strs ...string)
- func (c *Cmd) AssertOutExactly(s string)
- func (c *Cmd) AssertOutNotContains(s string)
- func (c *Cmd) AssertOutWithFunc(fn func(stdout string) error)
- func (c *Cmd) CmdOption(cmdOptions ...func(*Cmd)) *Cmd
- func (c *Cmd) Out() string
- func (c *Cmd) Run() *icmd.Result
- func (c *Cmd) Start() *icmd.Result
- type ComposeDir
Constants ¶
View Source
const ( FedoraESGZImage = "ghcr.io/stargz-containers/fedora:30-esgz" // eStargz FfmpegSociImage = "public.ecr.aws/soci-workshop-examples/ffmpeg:latest" // SOCI UbuntuImage = "public.ecr.aws/docker/library/ubuntu:23.10" // Large enough for testing soci index creation )
View Source
const Namespace = "nerdctl-test"
Variables ¶
View Source
var ( BusyboxImage = "ghcr.io/containerd/busybox:1.36" AlpineImage = mirrorOf("alpine:3.13") NginxAlpineImage = mirrorOf("nginx:1.19-alpine") NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>" RegistryImageStable = mirrorOf("registry:2") RegistryImageNext = "ghcr.io/distribution/distribution:" WordpressImage = mirrorOf("wordpress:5.7") WordpressIndexHTMLSnippet = "<title>WordPress › Installation</title>" MariaDBImage = mirrorOf("mariadb:10.5") DockerAuthImage = mirrorOf("cesanta/docker_auth:1.7") FluentdImage = "fluent/fluentd:v1.17.0-debian-1.0" KuboImage = mirrorOf("ipfs/kubo:v0.16.0") SystemdImage = "ghcr.io/containerd/stargz-snapshotter:0.15.1-kind" GolangImage = mirrorOf("golang:1.18") // Source: https://gist.github.com/cpuguy83/fcf3041e5d8fb1bb5c340915aabeebe0 NonDistBlobImage = "ghcr.io/cpuguy83/non-dist-blob:latest" // Foreign layer digest NonDistBlobDigest = "sha256:be691b1535726014cdf3b715ff39361b19e121ca34498a9ceea61ad776b9c215" CommonImage = AlpineImage // This error string is expected when attempting to connect to a TCP socket // for a service which actively refuses the connection. // (e.g. attempting to connect using http to an https endpoint). // It should be "connection refused" as per the TCP RFC. // https://www.rfc-editor.org/rfc/rfc793 ExpectedConnectionRefusedError = "connection refused" )
Functions ¶
func DockerIncompatible ¶
func GetAllowModifyUsers ¶ added in v2.1.0
func GetAllowModifyUsers() bool
func GetDaemonIsKillable ¶
func GetDaemonIsKillable() bool
func GetEnableIPv6 ¶
func GetEnableIPv6() bool
func GetEnableKubernetes ¶
func GetEnableKubernetes() bool
func GetFlakyEnvironment ¶
func GetFlakyEnvironment() bool
func Identifier ¶
Identifier can be used as a name of container, image, volume, network, etc.
func ImageRepo ¶
ImageRepo returns the image repo that can be used to, e.g, validate output from `nerdctl images`.
func LoadProject ¶
Load is used only for unit testing.
func RegisterBuildCacheCleanup ¶
RegisterBuildCacheCleanup adds a 'builder prune --all --force' cleanup function to run on test teardown.
func RequireContainerdPlugin ¶
func RequireExecPlatform ¶
func RequireExecutable ¶
RequireExecutable skips tests when executable `name` is not present in PATH.
func RequireKernelVersion ¶
func RequireSystemService ¶
func RequiresBuild ¶
Types ¶
type Base ¶
type Base struct { T testing.TB Target string DaemonIsKillable bool EnableIPv6 bool IPv6Compatible bool EnableKubernetes bool KubernetesCompatible bool Binary string Args []string Env []string Dir string }
func (*Base) ComposeCmd ¶
ComposeCmd executes `nerdctl -n nerdctl-test compose` or `docker-compose`
func (*Base) ComposeCmdWithHelper ¶
func (*Base) ContainerdAddress ¶
func (*Base) DumpDaemonLogs ¶
func (*Base) EnsureContainerExited ¶
func (*Base) EnsureContainerStarted ¶
func (*Base) EnsureDaemonActive ¶
func (b *Base) EnsureDaemonActive()
func (*Base) Info ¶
func (b *Base) Info() dockercompat.Info
func (*Base) InfoNative ¶
func (*Base) InspectContainer ¶
func (b *Base) InspectContainer(name string) dockercompat.Container
func (*Base) InspectImage ¶
func (b *Base) InspectImage(name string) dockercompat.Image
func (*Base) InspectNetwork ¶
func (b *Base) InspectNetwork(name string) dockercompat.Network
func (*Base) InspectVolume ¶
func (*Base) KillDaemon ¶
func (b *Base) KillDaemon()
type Cmd ¶
func (*Cmd) AssertCombinedOutContains ¶
func (*Cmd) AssertExitCode ¶
func (*Cmd) AssertFail ¶
func (c *Cmd) AssertFail()
func (*Cmd) AssertOutContains ¶
func (*Cmd) AssertOutContainsAll ¶
AssertOutContainsAll checks if command output contains All strings in `strs`.
func (*Cmd) AssertOutContainsAny ¶
AssertOutContainsAny checks if command output contains Any string in `strs`.
func (*Cmd) AssertOutExactly ¶
func (*Cmd) AssertOutNotContains ¶
func (*Cmd) AssertOutWithFunc ¶
type ComposeDir ¶
type ComposeDir struct {
// contains filtered or unexported fields
}
func NewComposeDir ¶
func NewComposeDir(t testing.TB, dockerComposeYAML string) *ComposeDir
func (*ComposeDir) CleanUp ¶
func (cd *ComposeDir) CleanUp()
func (*ComposeDir) Dir ¶
func (cd *ComposeDir) Dir() string
func (*ComposeDir) ProjectName ¶
func (cd *ComposeDir) ProjectName() string
func (*ComposeDir) WriteFile ¶
func (cd *ComposeDir) WriteFile(name, content string)
func (*ComposeDir) YAMLFullPath ¶
func (cd *ComposeDir) YAMLFullPath() string
Directories
¶
Path | Synopsis |
---|---|
portlock provides a mechanism for containers to acquire and release ports they plan to expose, and a wait mechanism This allows tests dependent on running containers to always parallelize without having to worry about port collision with any other test Note that this does NOT protect against trying to use a port that is already used by an unrelated third-party service or container Also note that *generally* finding a free port is not easy: - to just "listen" and see if it works won't work for containerized services that are DNAT-ed (plus, that would be racy) - inspecting iptables instead (or in addition to) may work for containers, but this depends on how networking has been set (and yes, it is also racy) Our approach here is optimistic: tests are responsible for calling Acquire and Release
|
portlock provides a mechanism for containers to acquire and release ports they plan to expose, and a wait mechanism This allows tests dependent on running containers to always parallelize without having to worry about port collision with any other test Note that this does NOT protect against trying to use a port that is already used by an unrelated third-party service or container Also note that *generally* finding a free port is not easy: - to just "listen" and see if it works won't work for containerized services that are DNAT-ed (plus, that would be racy) - inspecting iptables instead (or in addition to) may work for containers, but this depends on how networking has been set (and yes, it is also racy) Our approach here is optimistic: tests are responsible for calling Acquire and Release |
Click to show internal directories.
Click to hide internal directories.