Documentation
¶
Index ¶
- Constants
- func AssertEventuallyConsistent(t *testing.T, condition func() bool, timeout time.Duration, tick time.Duration, ...)
- func AssertNoError(t *testing.T, err error, msgAndArgs ...interface{})
- func AssertWithinDuration(t *testing.T, expected, actual time.Time, delta time.Duration, ...)
- func CreateSimpleTopology(addresses []string, epoch uint64) *clusterpb.ClusterTopology
- func CreateTopologyWithDownNodes(addresses []string, downIndices []int, epoch uint64) *clusterpb.ClusterTopology
- func GenerateTestData(size int) []byte
- func KeyValuePairs(prefix string, count int) map[string][]byte
- func RequireEventuallyConsistent(t *testing.T, condition func() bool, timeout time.Duration, tick time.Duration, ...)
- func RequireNoError(t *testing.T, err error, msgAndArgs ...interface{})
- func RetryWithBackoff(ctx context.Context, maxRetries int, initialDelay time.Duration, ...) error
- func RunConcurrently(n int, fn func(id int))
- func StandardErrorMessages() map[string]string
- func StandardTestKeys() []string
- func WaitForCondition(ctx context.Context, condition func() bool, timeout time.Duration) error
- type ErrorCollector
- type FailingReader
- type SafeBuffer
- type SafeReader
- type TestDataSet
Constants ¶
const ( SmallDataSize = 1024 // 1KB MediumDataSize = 64 * 1024 // 64KB LargeDataSize = 1024 * 1024 // 1MB )
Test data sizes
Variables ¶
This section is empty.
Functions ¶
func AssertEventuallyConsistent ¶
func AssertEventuallyConsistent(t *testing.T, condition func() bool, timeout time.Duration, tick time.Duration, msgAndArgs ...interface{})
AssertEventuallyConsistent checks that a condition becomes true within a timeout
func AssertNoError ¶
AssertNoError asserts that no error occurred and fails the test if there was
func AssertWithinDuration ¶
func AssertWithinDuration(t *testing.T, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{})
AssertWithinDuration asserts that two times are within a duration of each other
func CreateSimpleTopology ¶
func CreateSimpleTopology(addresses []string, epoch uint64) *clusterpb.ClusterTopology
CreateSimpleTopology creates a basic topology for testing with token assignments
func CreateTopologyWithDownNodes ¶
func CreateTopologyWithDownNodes(addresses []string, downIndices []int, epoch uint64) *clusterpb.ClusterTopology
CreateTopologyWithDownNodes creates a topology with some nodes marked as down
func GenerateTestData ¶
GenerateTestData generates test data of specified size
func KeyValuePairs ¶
KeyValuePairs generates a map of test key-value pairs
func RequireEventuallyConsistent ¶
func RequireEventuallyConsistent(t *testing.T, condition func() bool, timeout time.Duration, tick time.Duration, msgAndArgs ...interface{})
RequireEventuallyConsistent requires that a condition becomes true within a timeout
func RequireNoError ¶
RequireNoError requires that no error occurred and fails the test if there was
func RetryWithBackoff ¶
func RetryWithBackoff(ctx context.Context, maxRetries int, initialDelay time.Duration, maxDelay time.Duration, operation func() error) error
RetryWithBackoff retries an operation with exponential backoff
func RunConcurrently ¶
RunConcurrently runs a function concurrently n times and waits for completion
func StandardErrorMessages ¶
StandardErrorMessages returns common error messages for testing
func StandardTestKeys ¶
func StandardTestKeys() []string
StandardTestKeys returns a set of standard test keys
Types ¶
type ErrorCollector ¶
type ErrorCollector struct {
// contains filtered or unexported fields
}
CollectErrors collects errors from concurrent operations
func NewErrorCollector ¶
func NewErrorCollector(bufferSize int) *ErrorCollector
NewErrorCollector creates a new error collector
func (*ErrorCollector) Add ¶
func (ec *ErrorCollector) Add(err error)
Add adds an error to the collector
func (*ErrorCollector) Collect ¶
func (ec *ErrorCollector) Collect() []error
Collect collects all errors and returns them. This method can only be called once - subsequent calls will return the same slice.
func (*ErrorCollector) Count ¶
func (ec *ErrorCollector) Count() int
Count returns the number of errors collected
type FailingReader ¶
FailingReader fails after reading a certain amount
type SafeBuffer ¶
type SafeBuffer struct {
// contains filtered or unexported fields
}
SafeBuffer is a thread-safe buffer for testing
func (*SafeBuffer) Len ¶
func (s *SafeBuffer) Len() int
type SafeReader ¶
type SafeReader struct {
Data []byte
// contains filtered or unexported fields
}
SafeReader is a thread-safe reader for testing
type TestDataSet ¶
TestDataSet represents a set of test data with different sizes