test

package
v0.14.15-2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStarterClient

func NewStarterClient(t *testing.T, endpoint string) client.API

NewStarterClient creates a new starter API instance for the given endpoint, failing the test on errors.

func SendIntrAndWait

func SendIntrAndWait(t *testing.T, starters ...*SubProcess) bool

SendIntrAndWait stops all all given starter processes by sending a Ctrl-C into it. It then waits until the process has terminated.

func SetUniqueDataDir

func SetUniqueDataDir(t *testing.T) string

SetUniqueDataDir creates a temp dir and sets the DATA_DIR environment variable to it.

func ShutdownStarter

func ShutdownStarter(t *testing.T, endpoint string)

ShutdownStarter calls the starter the shutdown via the HTTP API.

func WaitUntilStarterGone

func WaitUntilStarterGone(t *testing.T, endpoint string)

WaitUntilStarterGone waits until the starter at given endpoint no longer responds to queries.

func WaitUntilStarterReady

func WaitUntilStarterReady(t *testing.T, what string, requiredGoodResults int, starters ...*SubProcess) bool

WaitUntilStarterReady waits until all given starter processes have reached the "Your cluster is ready state"

Types

type SubProcess

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

func NewSubProcess

func NewSubProcess(name string, arg ...string) (*SubProcess, error)

NewSubProcess creates a new process with given name and arguments. The process is not yet starter.

func Spawn

func Spawn(t *testing.T, command string) *SubProcess

Spawn a command an return its process and expand envs.

func SpawnWithExpand

func SpawnWithExpand(t *testing.T, command string, expand bool) *SubProcess

Spawn a command an return its process with optionally expanded envs.

func (*SubProcess) Close

func (sp *SubProcess) Close() error

Close terminates the process.

func (*SubProcess) ExpectTimeout

func (sp *SubProcess) ExpectTimeout(ctx context.Context, timeout time.Duration, re *regexp.Regexp, id string) error

ExpectTimeout waits for the output of the process to match the given expression, or until a timeout occurs. If a match on the given expression is found, the process output is discard until the end of the match and nil is returned, otherwise a timeout error is returned. If the given context is cancelled, nil is returned.

func (*SubProcess) Kill

func (sp *SubProcess) Kill() error

Kill terminates the process the hard way.

func (*SubProcess) SendIntr

func (sp *SubProcess) SendIntr() error

SendIntr sends a SIGINT to the process.

func (*SubProcess) Start

func (sp *SubProcess) Start() error

Start the process

func (*SubProcess) Wait

func (sp *SubProcess) Wait() error

Wait waits for the process to terminate.

func (*SubProcess) WaitTimeout

func (sp *SubProcess) WaitTimeout(timeout time.Duration) error

WaitTimeout waits for the process to terminate. Kill the process after the given timeout.

Jump to

Keyboard shortcuts

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