util

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Use for operations which are expected to succeed quickly.
	SmallWait = WaitTime(5 * time.Second)
	// Use for operators that can take a little while to start working.
	MedWait = WaitTime(30 * time.Second)
	// Use for operations which can take a while to succeed.
	LongWait = WaitTime(70 * time.Second)
	// Should not be used! Might be useful during development.
	LongestWait = WaitTime(200 * time.Second)
)
View Source
const DefaultTimeout = 15 * time.Second

Variables

This section is empty.

Functions

func Close

func Close(closer io.Closer)

func FindFreePort

func FindFreePort() int

Returns a free TCP port on the local machine or an error

func IndentJson

func IndentJson(in string) string

func LogG

func LogG(format string, a ...interface{})

LogG logs to the ginkgo writer. On test failure, it will print out whatever was written to it.

func WaitUntilSuccess

func WaitUntilSuccess(maxWait WaitTime, f func() error) error

Repeatedly runs a function, sleeping for a bit after each time, until it returns nil or reaches maxRepeats.

Types

type CmdBuilder

type CmdBuilder struct {
	// contains filtered or unexported fields
}

func Cmd

func Cmd(name string, args ...string) *CmdBuilder

func (*CmdBuilder) CaptureStderr

func (cb *CmdBuilder) CaptureStderr(out *strings.Builder) *CmdBuilder

func (*CmdBuilder) CaptureStdout

func (cb *CmdBuilder) CaptureStdout(out *strings.Builder) *CmdBuilder

func (*CmdBuilder) Env

func (cb *CmdBuilder) Env(name string, value string) *CmdBuilder

func (*CmdBuilder) NoTimeout

func (cb *CmdBuilder) NoTimeout() *CmdBuilder

func (*CmdBuilder) PrintCommand

func (cb *CmdBuilder) PrintCommand() *CmdBuilder

PrintCommand will cause the command and its arguments to be printed before it executes.

func (*CmdBuilder) PrintOutput

func (cb *CmdBuilder) PrintOutput() *CmdBuilder

func (*CmdBuilder) PrintStderr

func (cb *CmdBuilder) PrintStderr() *CmdBuilder

func (*CmdBuilder) PrintStdout

func (cb *CmdBuilder) PrintStdout() *CmdBuilder

func (*CmdBuilder) Run

func (cb *CmdBuilder) Run() error

Run starts and then waits for a process to finish.

func (*CmdBuilder) StartAsync

func (cb *CmdBuilder) StartAsync() error

StartAsync starts the process without waiting for its results. It will check it hasn't immediately died. Use StopAsync() to stop and wait for the results.

func (*CmdBuilder) StopAsync

func (cb *CmdBuilder) StopAsync() error

StopAsync stops a process started with StartAsync(). It will send a SIGTERM and ensure the process stops. It will only return an error if the process fails to stop.

func (*CmdBuilder) String

func (cb *CmdBuilder) String() string

func (*CmdBuilder) Timeout

func (cb *CmdBuilder) Timeout(t time.Duration) *CmdBuilder

type WaitTime

type WaitTime time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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