testing

package
v0.0.0-...-5650998 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2014 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package testing provides fake implementations of the exec package.

These implementations can be used to mock out the Executor in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorExecutor

type ErrorExecutor struct {
	FakeExecutor
}

func (*ErrorExecutor) Execute

func (e *ErrorExecutor) Execute(cmd string, args []string, stdin io.Reader, stdout, stderr io.Writer) error

type FailLaterExecutor

type FailLaterExecutor struct {
	FakeExecutor

	Succeeds int64
	// contains filtered or unexported fields
}

FailLaterExecutor is the opposite of RetryExecutor. It fails after N Succeeds.

func (*FailLaterExecutor) Execute

func (e *FailLaterExecutor) Execute(cmd string, args []string, stdin io.Reader, stdout, stderr io.Writer) error

type FakeExecutor

type FakeExecutor struct {
	Output map[string][][]byte
	// contains filtered or unexported fields
}

func (*FakeExecutor) Execute

func (e *FakeExecutor) Execute(cmd string, args []string, stdin io.Reader, stdout, stderr io.Writer) error

func (*FakeExecutor) ExecutedCmd

func (e *FakeExecutor) ExecutedCmd(cmd string, args []string) bool

func (*FakeExecutor) GetCommands

func (e *FakeExecutor) GetCommands(cmdName string) []command

type RetryExecutor

type RetryExecutor struct {
	FakeExecutor

	// How many times will it fail before succeeding?
	Failures int64
	// contains filtered or unexported fields
}

RetryExecutor succeeds after N failures.

func (*RetryExecutor) Execute

func (e *RetryExecutor) Execute(cmd string, args []string, stdin io.Reader, stdout, stderr io.Writer) error

Jump to

Keyboard shortcuts

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