Documentation
¶
Index ¶
- func AssertIdempotent(t *testing.T, fn func(*testing.T))
- func AssertIdempotentSubtest(t *testing.T, fn func(*testing.T)) func(*testing.T)
- func BoltDB(t testing.TB) *bbolt.DB
- func Copy(t testing.TB, src, dst string)
- func CreateInMemoryListeners(addresses []string) (map[string]*bufconn.Listener, grpc.DialOption)
- func Duration(d string) time.Duration
- func GetFreePorts(len int) (ports []int, err error)
- func Time(t string) time.Time
- func ULID(t string) string
- func UnixMilli(t string) int64
- type CapturedOutput
- type TestingLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertIdempotent ¶
AssertIdempotent asserts that the test is valid when run multiple times.
func AssertIdempotentSubtest ¶
func CreateInMemoryListeners ¶
Create in-memory listeners at given addresses. Also returns gRPC dial option for a client to connect to the appropriate in-memory listener for a given address.
func GetFreePorts ¶ added in v2.3.0
GetFreePorts returns a number of free local port for the tests to listen on. This will make sure the returned ports do not overlap, by stopping to listen once all ports are allocated
Note: This function should only be used in integration tests. Use in-memory network connections in unittests.
Types ¶
type CapturedOutput ¶
type CapturedOutput struct {
// contains filtered or unexported fields
}
func CaptureOutput ¶
func CaptureOutput(t *testing.T) *CapturedOutput
CaptureOutput replaces os.Stdout and os.Stderr with new pipes, that will write output to buffers. Buffers are accessible by calling Done on returned struct.
os.Stdout and os.Stderr must be reverted to previous values manually.
func (*CapturedOutput) Done ¶
func (co *CapturedOutput) Done() (stdout string, stderr string)
Done waits until all captured output has been written to buffers, and then returns the buffers.
type TestingLogger ¶
type TestingLogger struct {
// contains filtered or unexported fields
}
func NewTestingLogger ¶
func NewTestingLogger(t testing.TB) *TestingLogger
func (*TestingLogger) Log ¶
func (l *TestingLogger) Log(keyvals ...interface{}) error