test

package
v0.19.7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr added in v0.18.11

func BoolPtr(b bool) *bool

func CreateClient

func CreateClient(t *testing.T, starterEndpoint string, serverType client.ServerType,
	auth driver.Authentication) (driver.Client, error)

CreateClient creates a client to the server of the given type based on the arangodb starter endpoint.

func IsInterrupt added in v0.17.1

func IsInterrupt(err error) bool

func NewInterrupt added in v0.17.1

func NewInterrupt() error

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 ShutdownStarterCall added in v0.17.1

func ShutdownStarterCall(endpoint string) callFunction

ShutdownStarterCall returns function representation of ShutdownStarter.

func WaitUntilCoordinatorReadyAPI added in v0.17.1

func WaitUntilCoordinatorReadyAPI(t *testing.T, endpoint string) driver.Client

WaitUntilCoordinatorReadyAPI creates client with default root/password and waits until good response. Returns client

func WaitUntilServiceReadyRetryOn503 added in v0.17.1

func WaitUntilServiceReadyRetryOn503(t *testing.T, c driver.Client, check ServiceReadyCheckFunc) bool

WaitUntilServiceReadyRetryOn503 retry on 503 code from service

func WaitUntilServiceReadyRetryOnError added in v0.17.1

func WaitUntilServiceReadyRetryOnError(t *testing.T, c driver.Client, check ServiceReadyCheckFunc) bool

WaitUntilServiceReadyRetryOnError do not allow any errors to occur

func WaitUntilStarterExit added in v0.17.1

func WaitUntilStarterExit(t *testing.T, timeout time.Duration, exitCode int, starter *SubProcess)

WaitUntilStarterExit waits until given starter process will finish and checks for exit code

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 EnvironmentVariable added in v0.17.1

type EnvironmentVariable string

func (EnvironmentVariable) Lookup added in v0.17.1

func (e EnvironmentVariable) Lookup() (string, bool)

func (EnvironmentVariable) String added in v0.17.1

func (e EnvironmentVariable) String() string

type Interrupt added in v0.17.1

type Interrupt struct {
}

func (Interrupt) Error added in v0.17.1

func (i Interrupt) Error() string

type Logger added in v0.17.1

type Logger interface {
	Log(format string, args ...interface{})

	SubLogger(t *testing.T) Logger
	Checkpoint() Logger

	Clean()
}

func GetLogger added in v0.17.1

func GetLogger(t *testing.T) Logger

type MembersConfig added in v0.18.11

type MembersConfig struct {
	ID       string
	Port     int
	DataDir  string
	HasAgent *bool
	Process  *SubProcess
}

type ServiceReadyCheck added in v0.17.1

type ServiceReadyCheck func(t *testing.T, c driver.Client, check ServiceReadyCheckFunc) bool

type ServiceReadyCheckFunc added in v0.17.1

type ServiceReadyCheckFunc func(t *testing.T, ctx context.Context, c driver.Client) error

func ServiceReadyCheckDatabase added in v0.17.1

func ServiceReadyCheckDatabase(databaseName string) ServiceReadyCheckFunc

ServiceReadyCheckDatabase checks if database info can be fetched

func ServiceReadyCheckVersion added in v0.17.1

func ServiceReadyCheckVersion() ServiceReadyCheckFunc

ServiceReadyCheckVersion checks if version can be fetched

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 spawns a command and returns its process with optionally expanded envs.

func SpawnWithExpand

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

SpawnWithExpand spawns a command and returns its process with optionally expanded envs.

func (*SubProcess) Close

func (sp *SubProcess) Close() error

Close terminates the process.

func (*SubProcess) EnsureNoMatches added in v0.17.1

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

EnsureNoMatches returns error only if matches were found

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 canceled, nil is returned.

func (*SubProcess) Kill

func (sp *SubProcess) Kill() error

Kill terminates the process the hard way.

func (*SubProcess) Output added in v0.17.1

func (sp *SubProcess) Output() []byte

Output get current output

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) WaitT added in v0.17.1

func (sp *SubProcess) WaitT(t *testing.T)

WaitT waits for the process to terminate with require.

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.

type Throttle added in v0.17.1

type Throttle interface {
	Execute(func())
}

func NewThrottle added in v0.17.1

func NewThrottle(interval time.Duration) Throttle

type TimeoutFunc added in v0.17.1

type TimeoutFunc func() error

func NewTimeoutFunc added in v0.17.1

func NewTimeoutFunc(f func() error) TimeoutFunc

func WaitForHttpPortClosed added in v0.17.1

func WaitForHttpPortClosed(log Logger, throttle Throttle, url string) TimeoutFunc

func WaitUntilServiceReady added in v0.17.1

func WaitUntilServiceReady(t *testing.T, c driver.Client, checkFunc ServiceReadyCheckFunc, checks ...ServiceReadyCheck) TimeoutFunc

WaitUntilServiceReady retry on errors from service

func WaitUntilServiceReadyAPI added in v0.17.1

func WaitUntilServiceReadyAPI(t *testing.T, c driver.Client, check ServiceReadyCheckFunc) TimeoutFunc

WaitUntilServiceReadyAPI return timeout function which waits until service is fully ready

func (TimeoutFunc) Execute added in v0.17.1

func (f TimeoutFunc) Execute(timeout, interval time.Duration) error

func (TimeoutFunc) ExecuteT added in v0.17.1

func (f TimeoutFunc) ExecuteT(t *testing.T, timeout, interval time.Duration)

func (TimeoutFunc) ExecuteTWithLog added in v0.17.1

func (f TimeoutFunc) ExecuteTWithLog(t *testing.T, log Logger, timeout, interval time.Duration)

func (TimeoutFunc) ExecuteWithLog added in v0.17.1

func (f TimeoutFunc) ExecuteWithLog(log Logger, timeout, interval time.Duration) (err error)

Jump to

Keyboard shortcuts

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