Documentation
¶
Overview ¶
Package testutil provides common test utilities for the Starport project
Index ¶
- func AssertEventually(t *testing.T, condition func() bool, timeout time.Duration, message string)
- func Eventually(condition func() bool, timeout time.Duration) bool
- func WaitFor(t *testing.T, condition func() bool, timeout time.Duration, message string)
- func WaitForChannel[T any](t *testing.T, ch <-chan T, timeout time.Duration) T
- func WaitForExpiration(t *testing.T, store StorageGetter, key string, timeout time.Duration)
- func WaitForKeyNotExists(t *testing.T, store StorageGetter, key string, timeout time.Duration)
- func WaitForServer(t *testing.T, url string, timeout time.Duration)
- type StorageGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEventually ¶
AssertEventually asserts that a condition becomes true within the timeout
func Eventually ¶
Eventually runs a function repeatedly until it returns true or the timeout is reached This is similar to WaitFor but returns a boolean instead of failing the test
func WaitFor ¶
WaitFor polls a condition function until it returns true or the timeout is reached. It's useful for replacing time.Sleep in tests with a more deterministic approach.
func WaitForChannel ¶
WaitForChannel waits for a value to be received on a channel
func WaitForExpiration ¶
WaitForExpiration waits for a key to expire in storage
func WaitForKeyNotExists ¶
WaitForKeyNotExists waits for a key to not exist in storage