buildtest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Data

func Data(relpath string) ([]byte, error)

Data returns the contents of a file at the given path.

func DataAs

func DataAs(relpath string, obj interface{}) error

DataAs interprets the YAML contents of the file at the given path as the given type.

func PrettyJSON

func PrettyJSON(x interface{}) (string, error)

PrettyJSON pretty-prints a struct to a string.

func WaitNop

func WaitNop()

WaitNop is a convenience for passing into WaitUntil.

func YAMLToJSON

func YAMLToJSON(y []byte) ([]byte, error)

YAMLToJSON converts the given YAML bytes to JSON bytes.

Types

type Wait

type Wait struct {
	sync.WaitGroup
}

Wait extends WaitGroup with a few useful methods to avoid tests having a failure mode of hanging.

func NewWait

func NewWait() *Wait

NewWait is a convenience for creating a Wait object.

func (*Wait) Add

func (w *Wait) Add(delta int)

Add should be overridden by implementors.

func (*Wait) In

func (w *Wait) In(d time.Duration)

In calls Done() after the specified duration.

func (*Wait) WaitUntil

func (w *Wait) WaitUntil(d time.Duration, onSuccess func(), onTimeout func())

WaitUntil waits until Done() has been called or the specified duration has elapsed. If Done() is called, then onSuccess is called. If the duration elapses without Done() being called, then onTimeout is called.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳