Documentation
¶
Index ¶
- func Poll(fn PollFunc, opts PollOptions) error
- func Test(t *testing.T, tc TestCase)
- func WriteTestFile(t *testing.T, contents io.Reader) (string, error)
- func WriteTestFileWithName(t *testing.T, filename string, contents io.Reader) (string, error)
- type PollFunc
- type PollOptions
- type Step
- type TestCase
- type TestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Poll ¶
func Poll(fn PollFunc, opts PollOptions) error
Poll executes the given function `fn` until it returns no error, or until the configured number of tries or timeout is reached.
func WriteTestFile ¶ added in v0.6.0
WriteTestFile writes the provided contents from the reader into a newly created random-named file inside t.TempDir(). The created file has restrictive permissions (0600). It returns the full path to the created file or an error.
func WriteTestFileWithName ¶ added in v0.6.0
WriteTestFileWithName writes the provided contents from the reader into a file with the specified name inside t.TempDir(). The created file has restrictive permissions (0600). It returns the full path to the created file or an error.
Types ¶
type PollFunc ¶
type PollFunc func() error
PollFunc is the function to be executed by the Poll function. It should return an error to indicate a failure and that it should be retried. A nil error indicates success.
type PollOptions ¶
type PollOptions struct {
// Tries is the maximum number of times to try the function.
// If Tries is 0, it will retry until Timeout is reached.
Tries int
// Delay is the time to wait between retries.
// If Delay is 0, binary exponential backoff is used, starting at 2 seconds.
Delay time.Duration
// Timeout is the maximum total time to spend retrying.
// If Timeout is 0, there is no time limit.
Timeout time.Duration
}
PollOptions configures the behavior of the Poll function.
type Step ¶
type Step struct {
PreRun func(TestContext) error
Run func(TestContext) error
PostRun func(TestContext) error
Verify func(TestContext) error
}
Compact acc runner