environment

package
v1.4.2-0...-39377bb Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureFrozenImagesLinux

func EnsureFrozenImagesLinux(testEnv *Execution) error

EnsureFrozenImagesLinux loads frozen test images into the daemon if they aren't already loaded

func ProtectAll

func ProtectAll(t testingT, testEnv *Execution)

ProtectAll protects the existing environment (containers, images, networks, volumes, and, on Linux, plugins) from being cleaned up at the end of test runs

func ProtectContainers

func ProtectContainers(t testingT, testEnv *Execution)

ProtectContainers protects existing containers from being cleaned up at the end of test runs

func ProtectImages

func ProtectImages(t testingT, testEnv *Execution)

ProtectImages protects existing images and on linux frozen images from being cleaned up at the end of test runs

func ProtectNetworks

func ProtectNetworks(t testingT, testEnv *Execution)

ProtectNetworks protects existing networks from being cleaned up at the end of test runs

func ProtectPlugins

func ProtectPlugins(t testingT, testEnv *Execution)

ProtectPlugins protects existing plugins from being cleaned up at the end of test runs

func ProtectVolumes

func ProtectVolumes(t testingT, testEnv *Execution)

ProtectVolumes protects existing volumes from being cleaned up at the end of test runs

Types

type Execution

type Execution struct {
	DaemonInfo       types.Info
	OSType           string
	PlatformDefaults PlatformDefaults
	// contains filtered or unexported fields
}

Execution contains information about the current test execution and daemon under test

func New

func New() (*Execution, error)

New creates a new Execution struct

func (*Execution) APIClient

func (e *Execution) APIClient() client.APIClient

APIClient returns an APIClient connected to the daemon under test

func (*Execution) Clean

func (e *Execution) Clean(t testingT)

Clean the environment, preserving protected objects (images, containers, ...) and removing everything else. It's meant to run after any tests so that they don't depend on each others.

func (*Execution) IsLocalDaemon

func (e *Execution) IsLocalDaemon() bool

IsLocalDaemon is true if the daemon under test is on the same host as the CLI.

Deterministically working out the environment in which CI is running to evaluate whether the daemon is local or remote is not possible through a build tag.

For example Windows to Linux CI under Jenkins tests the 64-bit Windows binary build with the daemon build tag, but calls a remote Linux daemon.

We can't just say if Windows then assume the daemon is local as at some point, we will be testing the Windows CLI against a Windows daemon.

Similarly, it will be perfectly valid to also run CLI tests from a Linux CLI (built with the daemon tag) against a Windows daemon.

func (*Execution) Print

func (e *Execution) Print()

Print the execution details to stdout TODO: print everything

func (*Execution) ProtectContainer

func (e *Execution) ProtectContainer(t testingT, containers ...string)

ProtectContainer adds the specified container(s) to be protected in case of clean

func (*Execution) ProtectImage

func (e *Execution) ProtectImage(t testingT, images ...string)

ProtectImage adds the specified image(s) to be protected in case of clean

func (*Execution) ProtectNetwork

func (e *Execution) ProtectNetwork(t testingT, networks ...string)

ProtectNetwork adds the specified network(s) to be protected in case of clean

func (*Execution) ProtectPlugin

func (e *Execution) ProtectPlugin(t testingT, plugins ...string)

ProtectPlugin adds the specified plugin(s) to be protected in case of clean

func (*Execution) ProtectVolume

func (e *Execution) ProtectVolume(t testingT, volumes ...string)

ProtectVolume adds the specified volume(s) to be protected in case of clean

type PlatformDefaults

type PlatformDefaults struct {
	BaseImage            string
	VolumesConfigPath    string
	ContainerStoragePath string
}

PlatformDefaults are defaults values for the platform of the daemon under test

Jump to

Keyboard shortcuts

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