tests

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(r Retryer, t Failer, f func(r *R))

Types

type AFInstance

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

Saves state of the running Aquarium Fish for particular test

func RunAquariumFish

func RunAquariumFish(t *testing.T, cfg string) *AFInstance

func (*AFInstance) AdminToken

func (afi *AFInstance) AdminToken() string

Returns admin token

func (*AFInstance) ApiAddress

func (afi *AFInstance) ApiAddress(path string) string

Will return url to access API of AquariumFish

func (*AFInstance) Cleanup

func (afi *AFInstance) Cleanup(t *testing.T) error

Cleanup after the test execution

func (*AFInstance) IsRunning added in v0.7.0

func (afi *AFInstance) IsRunning() bool

Check the fish instance is running

func (*AFInstance) Restart added in v0.6.4

func (afi *AFInstance) Restart(t *testing.T) error

Restart the application

type Counter

type Counter struct {
	Count int
	Wait  time.Duration
	// contains filtered or unexported fields
}

Counter repeats an operation a given number of times and waits between subsequent operations.

func (*Counter) Continue

func (r *Counter) Continue() bool

type Failer

type Failer interface {
	Helper()

	// Log is called for the final test output
	Log(args ...any)

	// FailNow is called when the retrying is abandoned.
	FailNow()
}

Failer is an interface compatible with testing.T.

type R

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

R provides context for the retryer.

func (*R) Check

func (r *R) Check(err error)

func (*R) Error

func (r *R) Error(args ...any)

func (*R) Errorf

func (r *R) Errorf(format string, args ...any)

func (*R) FailNow

func (r *R) FailNow()

func (*R) Fatal

func (r *R) Fatal(args ...any)

func (*R) Fatalf

func (r *R) Fatalf(format string, args ...any)

func (*R) Helper

func (r *R) Helper()

func (*R) Stop

func (r *R) Stop(err error)

Stop retrying, and fail the test with the specified error.

type Retryer

type Retryer interface {
	// Continue returns true if the operation should be repeated, otherwise it
	// returns false to indicate retrying should stop.
	Continue() bool
}

Retryer provides an interface for repeating operations until they succeed or an exit condition is met.

type Timer

type Timer struct {
	Timeout time.Duration
	Wait    time.Duration
	// contains filtered or unexported fields
}

Timer repeats an operation for a given amount of time and waits between subsequent operations.

func (*Timer) Continue

func (r *Timer) Continue() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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