Back to

Package internal

v0.0.0 (1f91a0f)
Latest Go to latest
Published: Oct 18, 2018 | License: Apache-2.0 | Module:


Package Files

func CreateTmpDirectory

func CreateTmpDirectory(workdir string, runID string, name string) (string, error)

CreateTmpDirectory creates a temporary directory for running local programs, or storing logs. By default, the root of the tmp dir will be established by os.TempDir(). If workdir flag is specified, it will be used instead. The directory will be of the form <root>/<runID>/<name>/.

type Configurable

type Configurable interface {
	ApplyConfig(cfg string) error

Configurable interface is implemented by resources that needs to be updated when configuration changes.

type EnvironmentController

type EnvironmentController interface {

	Initialize(ctx *TestContext) error
	Configure(config string) error
	DumpState(context string)
	Reset() error

EnvironmentController is the internal interface that should be implemented by Environments. This is used by the driver to communicate with the environments in a standard way.

type Resettable

type Resettable interface {
	Reset() error

Resettable interface is implemented by resources that needs to be reset before reuse.

type TempFile

type TempFile string

TempFile represents a temporary file that was created.

func NewTempFile

func NewTempFile(tmpDir, prefix, suffix string) (TempFile, error)

NewTempFile creates and returns the name of a new temp file.

func WriteTempFile

func WriteTempFile(tmpDir, prefix, suffix, contents string) (TempFile, error)

WriteTempFile creates a temporary file with the specified contents.

func (TempFile) Delete

func (t TempFile) Delete()

Delete the temporary file.

type TestContext

type TestContext struct {

	// Tracker is visible for use from the driver.
	Tracker *Tracker
	// Registry is visible for use from the driver.
	Registry *registry.Registry
	// contains filtered or unexported fields

TestContext provides the ambient context to internal code.

func NewTestContext

func NewTestContext(s settings.Settings, impl environment.Implementation, registry *registry.Registry) *TestContext

NewTestContext initializes and returns a new instance of TestContext.

func (*TestContext) Environment

func (t *TestContext) Environment() environment.Implementation

Environment returns current environment implementation.

func (*TestContext) Settings

func (t *TestContext) Settings() settings.Settings

Settings returns current settings.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields

Tracker keeps track of the state information for dependencies

func (*Tracker) All

func (t *Tracker) All() []interface{}

All returns all tracked resources.

func (*Tracker) Cleanup

func (t *Tracker) Cleanup()

Cleanup closes all resources that implement io.Closer

func (*Tracker) Get

func (t *Tracker) Get(id dependency.Instance) (interface{}, bool)

Get the tracked resource with the given ID.

func (*Tracker) Initialize

func (t *Tracker) Initialize(ctx environment.ComponentContext, c component.Component) (interface{}, error)

Initialize a test dependency and start tracking it.

func (*Tracker) Reset

func (t *Tracker) Reset() error

Reset the all Resettable resources.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier