Documentation
¶
Overview ¶
Package queuetest provides a mock implementation of gas.JobQueueProvider for use in tests. The mock records all calls and allows configuring per-method behavior via function fields.
mock := &queuetest.MockQueue{}
mock.EnqueueFn = func(ctx context.Context, queue string, payload []byte, opts ...gas.EnqueueOption) error {
return nil
}
Index ¶
- type Call
- type MockQueue
- func (m *MockQueue) Ack(ctx context.Context, queue string, job gas.Job) error
- func (m *MockQueue) CallCount(method string) int
- func (m *MockQueue) Dequeue(ctx context.Context, queue string, maxMessages int, wait time.Duration) ([]gas.Job, error)
- func (m *MockQueue) Enqueue(ctx context.Context, queue string, payload []byte, opts ...gas.EnqueueOption) error
- func (m *MockQueue) Nack(ctx context.Context, queue string, job gas.Job) error
- func (m *MockQueue) Reset()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockQueue ¶
type MockQueue struct {
EnqueueFn func(ctx context.Context, queue string, payload []byte, opts ...gas.EnqueueOption) error
DequeueFn func(ctx context.Context, queue string, maxMessages int, wait time.Duration) ([]gas.Job, error)
AckFn func(ctx context.Context, queue string, job gas.Job) error
NackFn func(ctx context.Context, queue string, job gas.Job) error
Calls []Call
// contains filtered or unexported fields
}
MockQueue is a configurable mock of gas.JobQueueProvider. Each method delegates to its corresponding Fn field if set, otherwise returns the zero value. All calls are recorded in the Calls slice for assertions.
func (*MockQueue) Dequeue ¶
func (m *MockQueue) Dequeue(ctx context.Context, queue string, maxMessages int, wait time.Duration) ([]gas.Job, error)
Dequeue records the call and delegates to DequeueFn if set.
func (*MockQueue) Enqueue ¶
func (m *MockQueue) Enqueue(ctx context.Context, queue string, payload []byte, opts ...gas.EnqueueOption) error
Enqueue records the call and delegates to EnqueueFn if set.
Click to show internal directories.
Click to hide internal directories.