test

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package test provides simple Podman client convenience helpers to be used in unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContainer

func NewContainer(conn context.Context, desc NewContainerDescription, options ...NewContainerOption) (id string)

NewContainer creates a new container and optionally starts it, depending on the target container state configured in the passed container description. NewContainer only returns on success. Otherwise, a failed Gomega assertion will be raised.

func RemoveContainer

func RemoveContainer(conn context.Context, name string)

RemoveContainer removes (forcefully, where necessary) the specified container by name. It will succeed and return even if the container currently doesn't exist. All other errors will raise a failed Gomega assertion.

Types

type NewContainerDescription

type NewContainerDescription struct {
	Name   string
	Status TargetContainerStatus
	Labels map[string]string
}

NewContainerDescription describes the properties of a container to be newly created.

type NewContainerOption

type NewContainerOption func(spec *specgen.SpecGenerator)

NewContainerOption sets an optional specification property when creating a new container.

func AsPrivileged

func AsPrivileged() NewContainerOption

AsPrivileged requests a privileged container.

func OfPod

func OfPod(pod string) NewContainerOption

OfPod sets the name of the pod to which the newly created container belongs.

func WithCommand

func WithCommand(command []string) NewContainerOption

WithCommand specifies the command to start inside the new container.

func WithImage

func WithImage(image string) NewContainerOption

WithImage specifies the image from which the new container is to be created.

type TargetContainerStatus

type TargetContainerStatus int

TargetContainerStatus is the status a newly created container should reach (Created, Running, Paused).

const (
	Created TargetContainerStatus = iota // just create the container
	Running                              // start the container
	Paused                               // start, then pause the container
)

Target status a newly created container should reach.

Jump to

Keyboard shortcuts

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