testing

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	*testing.T

	// RootPath is a new temp directory where the environment starts.
	RootPath string
	// Current working directory.
	CWD string
}

Environment is an extension of the testing.T type that provides support for a test environment on the local disk. The Environment has a root directory (e.g. a newly created temp folder) and a current working directory (to virtually change directories).

func NewEnvironment

func NewEnvironment(t *testing.T) *Environment

NewEnvironment returns a new Environment object, located in a temp directory.

func (*Environment) DeleteEnvironment

func (e *Environment) DeleteEnvironment()

DeleteEnvironment deletes the environment's RootPath, and everything underneath it.

func (*Environment) GetCommandResults

func (e *Environment) GetCommandResults(t *testing.T, command string, args ...string) (string, string, error)

GetCommandResults runs the given command and args in the Environments CWD, returning STDOUT, STDERR, and the result of os/exec.Command{}.Run.

func (*Environment) ImportDirectory

func (e *Environment) ImportDirectory(path string)

ImportDirectory copies a folder into the test environment.

func (*Environment) LocalURL

func (e *Environment) LocalURL() string

LocalURL returns a URL that uses the "fire and forget", storing its data inside the test folder (so multiple tests) may reuse stack names.

func (*Environment) PathExists

func (e *Environment) PathExists(p string) bool

PathExists returns whether or not a file or directory exists relative to Environment's working directory.

func (*Environment) RunCommand

func (e *Environment) RunCommand(cmd string, args ...string) (string, string)

RunCommand runs the command expecting a zero exit code, returning stdout and stderr.

func (*Environment) RunCommandExpectError

func (e *Environment) RunCommandExpectError(cmd string, args ...string) (string, string)

RunCommandExpectError runs the command expecting a non-zero exit code, returning stdout and stderr.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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