testutils

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultContainerImage    = "docker.io/library/busybox"
	DefaultContainerImageTag = "latest"
)

Variables

Functions

func RunContainerdFailedContainer added in v0.18.0

func RunContainerdFailedContainer(ctx context.Context, t *testing.T)

func RunDockerFailedContainer

func RunDockerFailedContainer(ctx context.Context, t *testing.T)

Types

type Container added in v0.20.0

type Container interface {
	Run(t *testing.T)
	Start(t *testing.T)
	Stop(t *testing.T)
	ID() string
	Pid() int
	Running() bool
	PortBindings() nat.PortMap
}

func NewContainer added in v0.20.0

func NewContainer(runtime types.RuntimeName, name, cmd string, options ...Option) (Container, error)

func NewContainerdContainer added in v0.20.0

func NewContainerdContainer(name, cmd string, options ...Option) Container

func NewDockerContainer added in v0.20.0

func NewDockerContainer(name, cmd string, options ...Option) Container

type ContainerdContainer added in v0.20.0

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

func (*ContainerdContainer) ID added in v0.20.0

func (c *ContainerdContainer) ID() string

func (*ContainerdContainer) Pid added in v0.20.0

func (c *ContainerdContainer) Pid() int

func (*ContainerdContainer) PortBindings added in v0.25.0

func (c *ContainerdContainer) PortBindings() nat.PortMap

func (*ContainerdContainer) Run added in v0.20.0

func (c *ContainerdContainer) Run(t *testing.T)

func (*ContainerdContainer) Running added in v0.20.0

func (c *ContainerdContainer) Running() bool

func (*ContainerdContainer) Start added in v0.20.0

func (c *ContainerdContainer) Start(t *testing.T)

func (*ContainerdContainer) Stop added in v0.20.0

func (c *ContainerdContainer) Stop(t *testing.T)

type DockerContainer added in v0.20.0

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

func (*DockerContainer) ID added in v0.20.0

func (c *DockerContainer) ID() string

func (*DockerContainer) Pid added in v0.20.0

func (c *DockerContainer) Pid() int

func (*DockerContainer) PortBindings added in v0.25.0

func (c *DockerContainer) PortBindings() nat.PortMap

func (*DockerContainer) Run added in v0.20.0

func (d *DockerContainer) Run(t *testing.T)

func (*DockerContainer) Running added in v0.20.0

func (c *DockerContainer) Running() bool

func (*DockerContainer) Start added in v0.20.0

func (d *DockerContainer) Start(t *testing.T)

func (*DockerContainer) Stop added in v0.20.0

func (d *DockerContainer) Stop(t *testing.T)

type Option

type Option func(*containerOptions)

func WithContext added in v0.20.0

func WithContext(ctx context.Context) Option

func WithForceDelete added in v0.20.0

func WithForceDelete() Option

WithForceDelete is mostly used for debugging purposes, when a container fails to be deleted and we want to force it.

func WithImage

func WithImage(image string) Option

func WithImageTag added in v0.18.0

func WithImageTag(tag string) Option

func WithNamespace added in v0.20.0

func WithNamespace(namespace string) Option

WithNamespace sets the namespace of the container runtime

func WithPortBindings added in v0.25.0

func WithPortBindings(portBindings nat.PortMap) Option

WithPortBindings sets the exposed ports of the container

func WithSeccompProfile

func WithSeccompProfile(profile string) Option

func WithoutLogs

func WithoutLogs() Option

func WithoutWait

func WithoutWait() Option

Jump to

Keyboard shortcuts

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