Documentation
¶
Index ¶
- Constants
- Variables
- func AssertCmpEqual(t *testing.T, expected interface{}, actual interface{}, ...) bool
- func Consistently(timeout time.Duration, f func() bool) bool
- func ConsistentlyVerify(timeout time.Duration, mocks ...mock.HasVerify) error
- func CreateTempDirForTest(t *testing.T) string
- func Eventually(timeout time.Duration, f func() bool) bool
- func EventuallyVerify(timeout time.Duration, mocks ...mock.HasVerify) error
- func RandomPort() int
- func RequireCmpEqual(t *testing.T, expected interface{}, actual interface{}, ...)
- func RequireDoesNotContainNil(t *testing.T, obj interface{}) bool
- func RequireResult(t testing.TB, result protocol.ExecutionResult, tx transactionStatuser, ...)
- func RequireSuccess(t testing.TB, tx transactionStatuser, msg string, args ...interface{})
- func RetryAndLog(timeout time.Duration, logger log.Logger, f func() error) error
- func StartCpuSchedulingJitter()
- func WithConcurrencyHarness(tb testing.TB, f func(ctx context.Context, harness *ConcurrencyHarness))
- func WithContext(f func(ctx context.Context))
- func WithContextWithTimeout(d time.Duration, f func(ctx context.Context))
- type ConcurrencyHarness
Constants ¶
View Source
const CONSISTENTLY_ACCEPTANCE_TIMEOUT = 20 * time.Millisecond
View Source
const CONSISTENTLY_ADAPTER_TIMEOUT = 50 * time.Millisecond
View Source
const CONSISTENTLY_DOCKER_E2E_TIMEOUT = 500 * time.Millisecond
View Source
const CONSISTENTLY_LOCAL_E2E_TIMEOUT = 200 * time.Millisecond
View Source
const EVENTUALLY_ACCEPTANCE_TIMEOUT = 40 * time.Millisecond
View Source
const EVENTUALLY_ADAPTER_TIMEOUT = 100 * time.Millisecond
View Source
const EVENTUALLY_DOCKER_E2E_TIMEOUT = 1000 * time.Millisecond
View Source
const EVENTUALLY_LOCAL_E2E_TIMEOUT = 400 * time.Millisecond
Variables ¶
View Source
var ( MIN_REST_DURATION = 1 * time.Millisecond MAX_REST_DURATION = 5 * time.Millisecond MIN_BURST_DURATION = 1 * time.Millisecond MAX_BURST_DURATION = 10 * time.Millisecond )
Functions ¶
func AssertCmpEqual ¶
func ConsistentlyVerify ¶
func CreateTempDirForTest ¶
func EventuallyVerify ¶
func RandomPort ¶
func RandomPort() int
Random ports encourage flakiness. Instead, when possible, pass 0 as the TCP port and then retrieve the port for client usage:
listener, err := net.Listen("tcp", "127.0.0.1:0") port := listener.Addr().(*net.TCPAddr).Port
func RequireCmpEqual ¶
func RequireDoesNotContainNil ¶ added in v0.7.1
func RequireResult ¶ added in v1.2.1
func RequireResult(t testing.TB, result protocol.ExecutionResult, tx transactionStatuser, msg string, args ...interface{})
func RequireSuccess ¶
func RetryAndLog ¶ added in v1.2.1
func StartCpuSchedulingJitter ¶
func StartCpuSchedulingJitter()
creates ongoing random bursts of cpu noise (all cores together) to make goroutine scheduling erratic in -count 100 flakiness tests
func WithConcurrencyHarness ¶ added in v1.2.1
func WithConcurrencyHarness(tb testing.TB, f func(ctx context.Context, harness *ConcurrencyHarness))
creates a harness that should be used for running concurrent tests; these are tests that start long-running goroutines that need supervision the test function will run inside this function, and following the test running a synchronized shutdown of the supervised SUT will take place, followed by an assertion that no unexpected errors have been logged
func WithContext ¶
Types ¶
type ConcurrencyHarness ¶ added in v1.2.1
type ConcurrencyHarness struct { govnr.TreeSupervisor Logger log.Logger T testing.TB // contains filtered or unexported fields }
func (*ConcurrencyHarness) AllowErrorsMatching ¶ added in v1.2.1
func (h *ConcurrencyHarness) AllowErrorsMatching(pattern string)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.