Documentation
¶
Index ¶
- Constants
- func DockerIncompatible(t testing.TB)
- func GetDaemonIsKillable() bool
- func GetTarget() string
- func HyperVContainer(inspect dockercompat.Container) (bool, error)
- func HyperVSupported() bool
- func Identifier(t testing.TB) string
- func ImageRepo(s string) string
- func M(m *testing.M)
- func RequireContainerdPlugin(base *Base, requiredType, requiredID string, requiredCaps []string)
- func RequireDaemonVersion(b *Base, constraint 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) 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) AssertNoOut(s string)
- 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) AssertOutStreamsExactly(stdout, stderr string)
- func (c *Cmd) AssertOutStreamsWithFunc(fn func(stdout, stderr string) error)
- 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) OutLines() []string
- func (c *Cmd) Run() *icmd.Result
- type ComposeDir
- type Target
Constants ¶
const ( Nerdctl = Target("nerdctl") Docker = Target("docker") )
const ( WindowsNano = "gcr.io/k8s-staging-e2e-test-images/busybox:1.29-2" // CommonImage. // // More work needs to be done to support windows containers in test framework // for the tests that are run now this image (used in k8s upstream testing) meets the needs // use gcr.io/k8s-staging-e2e-test-images/busybox:1.29-2-windows-amd64-ltsc2022 locally on windows 11 // https://github.com/microsoft/Windows-Containers/issues/179 CommonImage = WindowsNano // NOTE(aznashwan): the upstream e2e Nginx test image is actually based on BusyBox. NginxAlpineImage = "registry.k8s.io/e2e-test-images/nginx:1.14-2" NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>" // 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, but it is the // below string constant on Windows. // https://www.rfc-editor.org/rfc/rfc793 ExpectedConnectionRefusedError = "No connection could be made because the target machine actively refused it." )
const Namespace = "nerdctl-test"
Variables ¶
This section is empty.
Functions ¶
func DockerIncompatible ¶
func GetDaemonIsKillable ¶
func GetDaemonIsKillable() bool
func HyperVContainer ¶ added in v1.4.0
func HyperVContainer(inspect dockercompat.Container) (bool, error)
HyperVContainer is a test helper to check if the container is a hyperv type container, lists only running containers
func HyperVSupported ¶ added in v1.4.0
func HyperVSupported() bool
HyperVSupported is a test helper to check if hyperv is enabled on the host. This can be used to skip tests that require virtualization.
func Identifier ¶ added in v0.16.0
Identifier can be used as a name of container, image, volume, network, etc.
func ImageRepo ¶ added in v1.2.1
ImageRepo returns the image repo that can be used to, e.g, validate output from `nerdctl images`.
func RequireContainerdPlugin ¶ added in v0.20.0
func RequireDaemonVersion ¶ added in v0.20.0
func RequireExecPlatform ¶ added in v0.13.0
func RequireExecutable ¶ added in v1.2.0
RequireExecutable skips tests when executable `name` is not present in PATH.
func RequireKernelVersion ¶ added in v0.23.0
func RequireSystemService ¶ added in v0.23.0
func RequiresBuild ¶
Types ¶
type Base ¶
type Base struct { T testing.TB Target Target DaemonIsKillable bool Binary string ComposeBinary string // "docker-compose" Args []string Env []string }
func NewBaseWithNamespace ¶ added in v1.1.0
func (*Base) ComposeCmd ¶ added in v0.8.0
ComposeCmd executes `nerdctl -n nerdctl-test compose` or `docker-compose`
func (*Base) ComposeCmdWithHelper ¶ added in v0.23.0
func (*Base) ContainerdAddress ¶ added in v1.2.0
func (*Base) DumpDaemonLogs ¶ added in v0.15.0
func (*Base) EnsureContainerStarted ¶ added in v0.22.0
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 (*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 (*Base) KillDaemon ¶
func (b *Base) KillDaemon()
type Cmd ¶
func (*Cmd) AssertCombinedOutContains ¶ added in v0.18.0
func (*Cmd) AssertExitCode ¶
func (*Cmd) AssertFail ¶
func (c *Cmd) AssertFail()
func (*Cmd) AssertNoOut ¶
func (*Cmd) AssertOutContains ¶ added in v0.8.1
func (*Cmd) AssertOutContainsAll ¶ added in v1.2.0
AssertOutContainsAll checks if command output contains All strings in `strs`.
func (*Cmd) AssertOutContainsAny ¶ added in v1.2.0
AssertOutContainsAny checks if command output contains Any string in `strs`.
func (*Cmd) AssertOutExactly ¶ added in v0.13.0
func (*Cmd) AssertOutNotContains ¶ added in v0.16.1
func (*Cmd) AssertOutStreamsExactly ¶ added in v1.1.0
func (*Cmd) AssertOutStreamsWithFunc ¶ added in v1.1.0
func (*Cmd) AssertOutWithFunc ¶
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