test

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 Test

func Test(t *testing.T, tc TestCase)

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

type TestCase

type TestCase struct {
	PreCheck func() error
	Steps    []Step
}

type TestContext

type TestContext interface {
	util.CmdContext
	Org() string
	OrgUrl() string
	PAT() string
}

Jump to

Keyboard shortcuts

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