Documentation ¶
Overview ¶
This is for test fixtures only.
Index ¶
- func DropSource(m *gostatsd.Metric)
- func EnsureAttachedTimers(tb testing.TB, clck *clock.Mock, expect int, until time.Duration) bool
- func MakeMetric(opts ...MetricOpt) *gostatsd.Metric
- func NewAdvancingClock(ctx context.Context) (context.Context, func())
- func NewTestLogger(tb testing.TB, opts ...func(logrus.FieldLogger)) logrus.FieldLogger
- func NextStep(ctx context.Context, clck *clock.Mock)
- func SortCompare(ms []*gostatsd.Metric) func(i, j int) bool
- type MetricOpt
- type MockNodePicker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropSource ¶
func EnsureAttachedTimers ¶
EnsureAttachedTimers will block execution until either expected number of timers are reached or the until duration has been reached causing this method to fail the test. A true result is returned when the assertion passes allow for control flow of control, otherwise the assertional failed and should ensure the test fails gracefully.
func MakeMetric ¶
MakeMetric provides a way to build a metric for tests. Hopefully over time this will be used more, bringing more consistency to tests.
func NewAdvancingClock ¶
NewAdvancingClock attaches a virtual clock to a context which advances at full speed (not wall speed), and a cancel function to stop it. The clock also stops if the context is canceled.
func NewTestLogger ¶
func NewTestLogger(tb testing.TB, opts ...func(logrus.FieldLogger)) logrus.FieldLogger
func NextStep ¶
NextStep will advance the supplied clock.Mock until it moves, or the context.Context is canceled (which typically means it timed out in wall-time). This is useful when testing things that exist inside goroutines, when it's not possible to tell when the goroutine is ready to consume mock time.
Types ¶
type MockNodePicker ¶
type MockNodePicker struct { TB testing.TB FnAdd func(node string) FnList func() []string FnRemove func(node string) FnRun func(ctx context.Context) FnSelect func(key string) (string, bool, error) }
MockNodePicker implements a mock nodes.NodePicker from github.com/atlassian/gostatsd/internal/cluster/nodes
func (*MockNodePicker) Add ¶
func (m *MockNodePicker) Add(node string)
func (*MockNodePicker) List ¶
func (m *MockNodePicker) List() (p0 []string)
func (*MockNodePicker) Remove ¶
func (m *MockNodePicker) Remove(node string)
func (*MockNodePicker) Run ¶
func (m *MockNodePicker) Run(ctx context.Context)