Documentation ¶
Overview ¶
Package qtest contains standard testing routines for exercising various backends in similar ways.
Index ¶
- func ClientService(ctx context.Context, opener entroq.BackendOpener) (client *entroq.EntroQ, stop func(), err error)
- func EqualAllTasksOrderedSkipIDAndTime(want, got []*entroq.Task) string
- func EqualAllTasksUnorderedByValue(want, got []*entroq.Task) string
- func EqualAllTasksUnorderedSkipTimesAndCounters(want, got []*entroq.Task, opts ...cmpOpt) string
- func EqualTasksVersionIncr(want, got *entroq.Task, versionBump int) string
- func InsertWithID(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func MultiWorker(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func QueueMatch(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func QueueStats(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func SimpleChange(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func SimpleSequence(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func SimpleWorker(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func TasksOmitValue(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func TasksWithID(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func TasksWithIDOnly(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func WorkerDependencyHandler(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func WorkerMoveOnError(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func WorkerRenewal(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- func WorkerRetryOnError(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
- type Dialer
- type Tester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientService ¶
func ClientService(ctx context.Context, opener entroq.BackendOpener) (client *entroq.EntroQ, stop func(), err error)
ClientService starts an in-memory gRPC network service via StartService, then creates an EntroQ client that connects to it. It returns the client and a function that can be deferred for cleanup.
The opener is used by the service to connect to storage. The client always uses a grpc opener.
func EqualAllTasksOrderedSkipIDAndTime ¶ added in v0.8.4
EqualAllTasksOrderedSkipIDAndTime returns a string diff if the order of tasks or values of tasks in two slices is not equal. The slices should also be the same length.
func EqualAllTasksUnorderedByValue ¶ added in v0.8.4
EqualAllTasksUnorderedByValue checks that all task values from want are represented in got. It assumes IDs and queues are not important. Suitable for tests that set a unique value per task, but don't have ID information. Returns a string diff if different.
func EqualAllTasksUnorderedSkipTimesAndCounters ¶ added in v0.8.4
EqualAllTasksUnorderedSkipTimesAndCounters returns a diff if any non-time fields are different between unordered task lists. Sorts by ID to accomplish this.
func EqualTasksVersionIncr ¶
EqualTasksVersionIncr checks for equality, allowing a version increment.
func InsertWithID ¶
InsertWithID tests the ability to insert tasks with a specified ID, including errors when an existing ID is used for insertion.
func MultiWorker ¶
func QueueMatch ¶
QueueMatch tests various queue matching functions against a client.
func QueueStats ¶
QueueStats checks that queue stats basically work.
func SimpleChange ¶
SimpleChange tests that changing things in the task leave most of it intact, and can handle things like queue moves.
func SimpleSequence ¶
SimpleSequence tests some basic functionality of a task manager, over gRPC.
func SimpleWorker ¶
SimpleWorker tests basic worker functionality while tasks are coming in and being waited on.
func TasksOmitValue ¶
TasksOmitValue exercises the task query where values are not desired.
func TasksWithID ¶
TasksWithID exercises the task query mechanism that allows specific task IDs to be looked up.
func TasksWithIDOnly ¶
TasksWithIDOnly tests that tasks listed by ID only (no queue) can return from multiple queues.
func WorkerDependencyHandler ¶
func WorkerDependencyHandler(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)
WorkerDependencyHandler tests that workers with specified dependency handlers get called on dependency errors, and that upgrades to fatal errors happen appropriately.
func WorkerMoveOnError ¶
WorkerMoveOnError tests that workers that have MoveTaskError results, causing tasks to be moved instead of crashing.
func WorkerRenewal ¶
WorkerRenewal tests that task claims are renewed periodically for longer-running work tasks.
Types ¶
type Dialer ¶
Dialer returns a net connection.
func StartService ¶
StartService starts an in-memory gRPC network service and returns a function for creating client connections to it.