test

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectNilError

func ExpectNilError[T any](f func() (T, error)) T

func MarshalAndStringify

func MarshalAndStringify(v interface{}) string

func NewBatchWithCapacityFrom

func NewBatchWithCapacityFrom[V interface{}](indices []int, values []V, capacity int) *batching.Batch[V]

Resizes the indices and values to the given capacity before returning a new batch.

func TestExponentialBackoff

func TestExponentialBackoff() *messaging.ExponentialBackoff

func ToPtr

func ToPtr[T any](v T) *T

Types

type MockBatchKeyGetter

type MockBatchKeyGetter[I interface{}, K interface{}] struct {
	DoGetBatchKey func(I) (K, error)
}

func (*MockBatchKeyGetter[I, K]) GetBatchKey

func (getter *MockBatchKeyGetter[I, K]) GetBatchKey(input I) (K, error)

type MockBatchSubmitter

type MockBatchSubmitter[K interface{}, V interface{}] struct {
	DoSubmit func(key K, batch batching.Batch[V]) error
}

func (*MockBatchSubmitter[K, V]) Submit

func (submitter *MockBatchSubmitter[K, V]) Submit(key K, batch batching.Batch[V]) error

type MockBatchValueGetter

type MockBatchValueGetter[I interface{}, V interface{}] struct {
	DoGetBatchValue func(I) (V, error)
}

func (*MockBatchValueGetter[I, V]) GetBatchValue

func (getter *MockBatchValueGetter[I, V]) GetBatchValue(input I) (V, error)

type MockHttpClient

type MockHttpClient struct {
	DoFunc func(req *http.Request) (*http.Response, error)
}

func (*MockHttpClient) Do

func (m *MockHttpClient) Do(req *http.Request) (*http.Response, error)

type MockLog

type MockLog struct {
	Level    logging.Level
	Messages []string
}

type MockLogger

type MockLogger struct {
	Context []string
	Logs    []MockLog
}

func (*MockLogger) Error

func (m *MockLogger) Error(messages ...string)

func (*MockLogger) ErrorNoContextNoFormat

func (m *MockLogger) ErrorNoContextNoFormat(message string)

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(messages ...string)

func (*MockLogger) FatalNoContextNoFormat

func (m *MockLogger) FatalNoContextNoFormat(message string)

func (*MockLogger) FormatAndAddContext

func (m *MockLogger) FormatAndAddContext(level logging.Level, messages ...string) string

func (*MockLogger) Info

func (m *MockLogger) Info(messages ...string)

func (*MockLogger) InfoNoContextNoFormat

func (m *MockLogger) InfoNoContextNoFormat(message string)

func (*MockLogger) SetLevel

func (m *MockLogger) SetLevel(level logging.Level)

func (*MockLogger) Warn

func (m *MockLogger) Warn(messages ...string)

func (*MockLogger) WarnNoContextNoFormat

func (m *MockLogger) WarnNoContextNoFormat(message string)

func (*MockLogger) WithContext

func (m *MockLogger) WithContext(context ...string) logging.Logger

type MockReadCloser

type MockReadCloser struct {
	io.ReadCloser
	NCloseCalls int
	NReadCalls  int
}

func (*MockReadCloser) Close

func (r *MockReadCloser) Close() error

func (*MockReadCloser) Read

func (r *MockReadCloser) Read(p []byte) (int, error)

type MockRequestFlow

type MockRequestFlow struct {
	SendFunc   func() error
	IsDoneFunc func() bool
}

func (*MockRequestFlow) IsDone

func (m *MockRequestFlow) IsDone() bool

func (*MockRequestFlow) Send

func (m *MockRequestFlow) Send() error

Jump to

Keyboard shortcuts

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