drivers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Docker = "docker"
	Tar    = "tar"
	Host   = "host"
)

Variables

This section is empty.

Functions

func InitDriverImpl

func InitDriverImpl(driver string) func(DriverConfig) (Driver, error)

func ResetEnvVars added in v0.2.0

func ResetEnvVars(t *testing.T, vars []unversioned.EnvVar)

func SetEnvVars added in v0.2.0

func SetEnvVars(t *testing.T, vars []unversioned.EnvVar) []unversioned.EnvVar

given a list of environment variable key/value pairs, set these in the current environment. also, keep track of the previous values of these vars to reset after test execution.

Types

type DockerDriver

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

func (*DockerDriver) Destroy

func (d *DockerDriver) Destroy(t *testing.T)

func (*DockerDriver) GetConfig

func (d *DockerDriver) GetConfig(t *testing.T) (unversioned.Config, error)

func (*DockerDriver) ProcessCommand

func (d *DockerDriver) ProcessCommand(t *testing.T, envVars []unversioned.EnvVar, fullCommand []string) (string, string, int)

func (*DockerDriver) ReadDir

func (d *DockerDriver) ReadDir(t *testing.T, target string) ([]os.FileInfo, error)

func (*DockerDriver) ReadFile

func (d *DockerDriver) ReadFile(t *testing.T, target string) ([]byte, error)

func (*DockerDriver) Setup

func (d *DockerDriver) Setup(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

func (*DockerDriver) StatFile

func (d *DockerDriver) StatFile(t *testing.T, target string) (os.FileInfo, error)

func (*DockerDriver) Teardown added in v0.2.0

func (d *DockerDriver) Teardown(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

type Driver

type Driver interface {
	Setup(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

	// Teardown is optional and is only used in the host driver
	Teardown(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

	// given an array of command parts, construct a full command and execute it against the
	// current environment. a list of environment variables can be passed to be set in the
	// environment before the command is executed. additionally, a boolean flag is passed
	// to specify whether or not we care about the output of the command.
	ProcessCommand(t *testing.T, envVars []unversioned.EnvVar, fullCommand []string) (string, string, int)

	StatFile(t *testing.T, path string) (os.FileInfo, error)

	ReadFile(t *testing.T, path string) ([]byte, error)

	ReadDir(t *testing.T, path string) ([]os.FileInfo, error)

	GetConfig(t *testing.T) (unversioned.Config, error)

	Destroy(t *testing.T)
}

func NewDockerDriver

func NewDockerDriver(args DriverConfig) (Driver, error)

func NewHostDriver added in v0.2.0

func NewHostDriver(args DriverConfig) (Driver, error)

func NewTarDriver

func NewTarDriver(args DriverConfig) (Driver, error)

type DriverConfig added in v0.2.0

type DriverConfig struct {
	Image    string // used by Docker/Tar drivers
	Save     bool   // used by Docker/Tar drivers
	Metadata string // used by Host driver
}

type HostDriver added in v0.2.0

type HostDriver struct {
	ConfigPath string // path to image metadata config on host fs
	GlobalVars []unversioned.EnvVar
}

func (*HostDriver) Destroy added in v0.2.0

func (d *HostDriver) Destroy(t *testing.T)

func (*HostDriver) GetConfig added in v0.2.0

func (d *HostDriver) GetConfig(t *testing.T) (unversioned.Config, error)

func (*HostDriver) ProcessCommand added in v0.2.0

func (d *HostDriver) ProcessCommand(t *testing.T, envVars []unversioned.EnvVar, fullCommand []string) (string, string, int)

func (*HostDriver) ReadDir added in v0.2.0

func (d *HostDriver) ReadDir(t *testing.T, path string) ([]os.FileInfo, error)

func (*HostDriver) ReadFile added in v0.2.0

func (d *HostDriver) ReadFile(t *testing.T, path string) ([]byte, error)

func (*HostDriver) Setup added in v0.2.0

func (d *HostDriver) Setup(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

func (*HostDriver) StatFile added in v0.2.0

func (d *HostDriver) StatFile(t *testing.T, path string) (os.FileInfo, error)

func (*HostDriver) Teardown added in v0.2.0

func (d *HostDriver) Teardown(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

type TarDriver

type TarDriver struct {
	Image pkgutil.Image
	Save  bool
}

func (*TarDriver) Destroy

func (d *TarDriver) Destroy(t *testing.T)

func (*TarDriver) GetConfig

func (d *TarDriver) GetConfig(t *testing.T) (unversioned.Config, error)

func (*TarDriver) ProcessCommand

func (d *TarDriver) ProcessCommand(t *testing.T, envVars []unversioned.EnvVar, fullCommand []string) (string, string, int)

func (*TarDriver) ReadDir

func (d *TarDriver) ReadDir(t *testing.T, path string) ([]os.FileInfo, error)

func (*TarDriver) ReadFile

func (d *TarDriver) ReadFile(t *testing.T, path string) ([]byte, error)

func (*TarDriver) Setup

func (d *TarDriver) Setup(t *testing.T, envVars []unversioned.EnvVar, fullCommand [][]string)

func (*TarDriver) StatFile

func (d *TarDriver) StatFile(t *testing.T, path string) (os.FileInfo, error)

func (*TarDriver) Teardown added in v0.2.0

func (d *TarDriver) Teardown(t *testing.T, envVars []unversioned.EnvVar, fullCommands [][]string)

Jump to

Keyboard shortcuts

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