drivers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: Apache-2.0 Imports: 19 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

func ResetEnvVars(envVars []unversioned.EnvVar)

func SetEnvVars

func SetEnvVars(envVars []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()

func (*DockerDriver) GetConfig

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

func (*DockerDriver) ProcessCommand

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

func (*DockerDriver) ReadDir

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

func (*DockerDriver) ReadFile

func (d *DockerDriver) ReadFile(target string) ([]byte, error)

func (*DockerDriver) SetEnv added in v1.2.0

func (d *DockerDriver) SetEnv(envVars []unversioned.EnvVar) error

func (*DockerDriver) Setup

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

func (*DockerDriver) StatFile

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

func (*DockerDriver) Teardown

func (d *DockerDriver) Teardown(_ [][]string) error

type Driver

type Driver interface {
	Setup(envVars []unversioned.EnvVar, fullCommands [][]string) error

	// Teardown is optional and is only used in the host driver
	Teardown(fullCommands [][]string) error

	SetEnv(envVars []unversioned.EnvVar) error

	// 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(envVars []unversioned.EnvVar, fullCommand []string) (string, string, int, error)

	StatFile(path string) (os.FileInfo, error)

	ReadFile(path string) ([]byte, error)

	ReadDir(path string) ([]os.FileInfo, error)

	GetConfig() (unversioned.Config, error)

	Destroy()
}

func NewDockerDriver

func NewDockerDriver(args DriverConfig) (Driver, error)

func NewHostDriver

func NewHostDriver(args DriverConfig) (Driver, error)

func NewTarDriver

func NewTarDriver(args DriverConfig) (Driver, error)

type DriverConfig

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

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

func (*HostDriver) Destroy

func (d *HostDriver) Destroy()

func (*HostDriver) GetConfig

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

func (*HostDriver) ProcessCommand

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

func (*HostDriver) ReadDir

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

func (*HostDriver) ReadFile

func (d *HostDriver) ReadFile(path string) ([]byte, error)

func (*HostDriver) SetEnv added in v1.2.0

func (d *HostDriver) SetEnv(envVars []unversioned.EnvVar) error

func (*HostDriver) Setup

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

func (*HostDriver) StatFile

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

func (*HostDriver) Teardown

func (d *HostDriver) Teardown(fullCommands [][]string) error

type TarDriver

type TarDriver struct {
	Image pkgutil.Image
	Save  bool
}

func (*TarDriver) Destroy

func (d *TarDriver) Destroy()

func (*TarDriver) GetConfig

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

func (*TarDriver) ProcessCommand

func (d *TarDriver) ProcessCommand(_ []unversioned.EnvVar, _ []string) (string, string, int, error)

func (*TarDriver) ReadDir

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

func (*TarDriver) ReadFile

func (d *TarDriver) ReadFile(path string) ([]byte, error)

func (*TarDriver) SetEnv added in v1.2.0

func (d *TarDriver) SetEnv(envVars []unversioned.EnvVar) error

func (*TarDriver) Setup

func (d *TarDriver) Setup(_ []unversioned.EnvVar, _ [][]string) error

func (*TarDriver) StatFile

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

func (*TarDriver) Teardown

func (d *TarDriver) Teardown(_ [][]string) error

Jump to

Keyboard shortcuts

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