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 EqualAllTasks(want, got []*entroq.Task) string
- func EqualAllTasksOmitValues(want, got []*entroq.Task) string
- func EqualAllTasksVersionIncr(want, got []*entroq.Task, versionBump int) string
- func EqualTasks(want, got *entroq.Task) 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 EqualAllTasks ¶
EqualAllTasks returns a string diff if any of the tasks in the lists are unequal.
func EqualAllTasksOmitValues ¶ added in v0.3.9
EqualAllTasksOmitValues returns a string diff if any tasks in the list are unequal, not counting values in want (leaving got alone).
func EqualAllTasksVersionIncr ¶
EqualAllTasksVersionIncr returns a non-empty diff if any of the tasks are unequal, taking a version increment into account for the 'got' tasks.
func EqualTasks ¶
Checks for task equality, ignoring Version and all time fields.
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 ¶ added in v0.3.0
func QueueMatch ¶
QueueMatch tests various queue matching functions against a client.
func QueueStats ¶ added in v0.3.3
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 ¶ added in v0.3.9
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 ¶ added in v0.3.2
TasksWithIDOnly tests that tasks listed by ID only (no queue) can return from multiple queues.
func WorkerDependencyHandler ¶ added in v0.3.17
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 ¶ added in v0.2.7
WorkerMoveOnError tests that workers that have MoveTaskError results, causing tasks to be moved instead of crashing.
func WorkerRenewal ¶ added in v0.1.3
WorkerRenewal tests that task claims are renewed periodically for longer-running work tasks.
func WorkerRetryOnError ¶ added in v0.4.3
WorkerRetryOnError test that workers that have RetryTaskError results increment attempts and set the error properly. It also checks that after max attempts, things get moved.
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.