framework

package
v0.0.0-...-b51b046 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryForDuration

func RetryForDuration(retryFunc func() error, dur time.Duration) error

Runs retryFunc until no error is returned. After dur time the last error is returned. Note that the function does not timeout the execution of retryFunc when the limit is reached.

Types

type CadvisorActions

type CadvisorActions interface {
	// Returns a cAdvisor client to the machine being tested.
	Client() *client.Client
}

type DockerActions

type DockerActions interface {
	// Run the no-op pause Docker container and return its ID.
	RunPause() string

	// Run the specified command in a Docker busybox container and return its ID.
	RunBusybox(cmd ...string) string

	// Runs a Docker container in the background. Uses the specified DockerRunArgs and command.
	// Returns the ID of the new container.
	//
	// e.g.:
	// Run(DockerRunArgs{Image: "busybox"}, "ping", "www.google.com")
	//   -> docker run busybox ping www.google.com
	Run(args DockerRunArgs, cmd ...string) string
}

type DockerRunArgs

type DockerRunArgs struct {
	// Image to use.
	Image string

	// Arguments to the Docker CLI.
	Args []string
}

type Framework

type Framework interface {
	// Clean the framework state.
	Cleanup()

	// The testing.T used by the framework and the current test.
	T() *testing.T

	// Returns information about the host being tested.
	Host() HostInfo

	// Returns the Docker actions for the test framework.
	Docker() DockerActions

	// Returns the cAdvisor actions for the test framework.
	Cadvisor() CadvisorActions
}

Integration test framework.

func New

func New(t *testing.T) Framework

Instantiates a Framework. Cleanup *must* be called. Class is thread-compatible. All framework actions report fatal errors on the t specified at creation time.

Typical use:

func TestFoo(t *testing.T) {
	fm := framework.New(t)
	defer fm.Cleanup()
     ... actual test ...
}

type HostInfo

type HostInfo struct {
	Host            string
	Port            int
	GceInstanceName string
}

func (HostInfo) FullHost

func (self HostInfo) FullHost() string

Returns: http://<host>:<port>/

Jump to

Keyboard shortcuts

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