Documentation ¶
Index ¶
- func DoWithRetry(t *testing.T, actionDescription string, maxRetries int, ...) string
- func DoWithRetryE(t *testing.T, actionDescription string, maxRetries int, ...) (string, error)
- func DoWithTimeout(t *testing.T, actionDescription string, timeout time.Duration, ...) string
- func DoWithTimeoutE(t *testing.T, actionDescription string, timeout time.Duration, ...) (string, error)
- type Done
- type Either
- type FatalError
- type MaxRetriesExceeded
- type TimeoutExceeded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoWithRetry ¶
func DoWithRetry(t *testing.T, actionDescription string, maxRetries int, sleepBetweenRetries time.Duration, action func() (string, error)) string
Run the specified action. If it returns a value, return that value. If it returns a FatalError, return that error immediately. If it returns any other type of error, sleep for sleepBetweenRetries and try again, up to a maximum of maxRetries retries. If maxRetries is exceeded, fail the test.
func DoWithRetryE ¶
func DoWithRetryE(t *testing.T, actionDescription string, maxRetries int, sleepBetweenRetries time.Duration, action func() (string, error)) (string, error)
Run the specified action. If it returns a value, return that value. If it returns a FatalError, return that error immediately. If it returns any other type of error, sleep for sleepBetweenRetries and try again, up to a maximum of maxRetries retries. If maxRetries is exceeded, return a MaxRetriesExceeded error.
func DoWithTimeout ¶
func DoWithTimeout(t *testing.T, actionDescription string, timeout time.Duration, action func() (string, error)) string
Run the specified action and wait up to the specified timeout for it to complete. Return the output of the action if it completes on time or fail the test otherwise.
func DoWithTimeoutE ¶
func DoWithTimeoutE(t *testing.T, actionDescription string, timeout time.Duration, action func() (string, error)) (string, error)
Run the specified action and wait up to the specified timeout for it to complete. Return the output of the action if it completes on time or an error otherwise.
Types ¶
type Done ¶
type Done struct {
// contains filtered or unexported fields
}
func DoInBackgroundUntilStopped ¶
func DoInBackgroundUntilStopped(t *testing.T, actionDescription string, sleepBetweenRepeats time.Duration, action func()) Done
Run the specified action in the background (in a goroutine) repeatedly, waiting the specified amount of time between repetitions. To stop this action, call the Done() function on the returned value.
type FatalError ¶
type FatalError struct {
Underlying error
}
Marker interface for errors that should not be retried
func (FatalError) Error ¶
func (err FatalError) Error() string
type MaxRetriesExceeded ¶
func (MaxRetriesExceeded) Error ¶
func (err MaxRetriesExceeded) Error() string
type TimeoutExceeded ¶
func (TimeoutExceeded) Error ¶
func (err TimeoutExceeded) Error() string