resource

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsupportedEnvironment

func UnsupportedEnvironment(env Environment) error

UnsupportedEnvironment generates an error indicating that the given environment is not supported.

Types

type Context

type Context interface {
	// TrackResource tracks a resource in this context. If the context is closed, then the resource will be
	// cleaned up.
	TrackResource(r Resource) ID

	// The Environment in which the tests run
	Environment() Environment

	// Settings returns common settings
	Settings() *core.Settings

	// CreateDirectory creates a new subdirectory within this context.
	CreateDirectory(name string) (string, error)

	// CreateTmpDirectory creates a new temporary directory within this context.
	CreateTmpDirectory(prefix string) (string, error)
}

Context is the core context interface that is used by resources.

type Dumper

type Dumper interface {
	Dump()
}

Dumper is an interface that is implemented by all components that can dump their state. In CI, it is useful to get as much context as possible when a test fails. Dumper allows dumping of state from a test.

type Environment

type Environment interface {
	Resource

	EnvironmentName() environment.Name

	// Case calls the given function if this environment has the given name.
	Case(e environment.Name, fn func())
}

Environment is the ambient environment that the test runs in.

type ID

type ID interface {
	fmt.Stringer
}

ID for the resource instance. This is allocated by the framework and passed here.

type Resetter

type Resetter interface {
	Reset() error
}

Resetter is an interface that is implemented by resources that can be reset between executions within contexts.

type Resource

type Resource interface {

	// Debugging ID for the resource instance.
	ID() ID
}

Resource of a resource.

type SetupFn

type SetupFn func(ctx Context) error

SetupFn is a function used for performing setup actions.

Jump to

Keyboard shortcuts

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