cli

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExitHandlerFunc

func CreateExitHandlerFunc(t *testing.T, tee *Tee, expectedExitCode int, expectedErrorMessage string) func(int) bool

func HideEnv

func HideEnv(t *testing.T) func(t *testing.T)

Temporarily unsets the env variables for the test cases returns a function to reset them to their initial values

func InitTestConfig

func InitTestConfig(config string) error

func RunCommand

func RunCommand(f func(*cobra.Command, []string))

func SetOptionValue

func SetOptionValue(t *testing.T, testOption TestOption)

func SetupTmpMinishiftHome

func SetupTmpMinishiftHome(t *testing.T) string

SetupTmpMinishiftHome creates a tmp directory and points MINISHIFT_HOME to it. It returns the path to this tmp directory

func TearDown

func TearDown(testDir string, tee *Tee)

func UnsetValues

func UnsetValues(testOption TestOption)

Types

type Tee

type Tee struct {
	OrigStdout   *os.File
	OrigStderr   *os.File
	Stdout       *os.File
	Stderr       *os.File
	StdoutBuffer *bytes.Buffer
	StderrBuffer *bytes.Buffer
	// contains filtered or unexported fields
}

func CreateTee

func CreateTee(t *testing.T, silent bool) *Tee

CreateTee splits the stdout and stderr in order to capture these streams into a buffer during test execution. If silent is true, the original output streams are silenced.

func NewTee

func NewTee(silent bool) (*Tee, error)

NewTee splits os.Stdout and os.Stderr using a pipe. While the tee is not closed data written to stdout or stderr will be copied into a buffer as well well as printed to the original file handle, unless silent is true, in which case the original output streams are silenced.

func (*Tee) Close

func (t *Tee) Close()

type TestOption

type TestOption struct {
	Name          string
	EnvValue      string
	ConfigValue   string
	FlagValue     string
	ExpectedValue string
}

Jump to

Keyboard shortcuts

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