qtest

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package qtest contains standard testing routines for exercising various backends in similar ways.

Index

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

func EqualAllTasks(want, got []*entroq.Task) string

EqualAllTasks returns a string diff if any of the tasks in the lists are unequal.

func EqualAllTasksOmitValues added in v0.3.9

func EqualAllTasksOmitValues(want, got []*entroq.Task) string

EqualAllTasksOmitValues returns a string diff if any tasks in the list are unequal, not counting values in want (leaving got alone).

func EqualAllTasksVersionIncr

func EqualAllTasksVersionIncr(want, got []*entroq.Task, versionBump int) string

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

func EqualTasks(want, got *entroq.Task) string

Checks for task equality, ignoring Version and all time fields.

func EqualTasksVersionIncr

func EqualTasksVersionIncr(want, got *entroq.Task, versionBump int) string

EqualTasksVersionIncr checks for equality, allowing a version increment.

func InsertWithID

func InsertWithID(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

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 MultiWorker(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

func QueueMatch

func QueueMatch(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

QueueMatch tests various queue matching functions against a client.

func QueueStats added in v0.3.3

func QueueStats(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

QueueStats checks that queue stats basically work.

func SimpleChange

func SimpleChange(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

SimpleChange tests that changing things in the task leave most of it intact, and can handle things like queue moves.

func SimpleSequence

func SimpleSequence(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

SimpleSequence tests some basic functionality of a task manager, over gRPC.

func SimpleWorker

func SimpleWorker(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

SimpleWorker tests basic worker functionality while tasks are coming in and being waited on.

func TasksOmitValue added in v0.3.9

func TasksOmitValue(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

TasksOmitValue exercises the task query where values are not desired.

func TasksWithID

func TasksWithID(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

TasksWithID exercises the task query mechanism that allows specific task IDs to be looked up.

func TasksWithIDOnly added in v0.3.2

func TasksWithIDOnly(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

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

func WorkerMoveOnError(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

WorkerMoveOnError tests that workers that have MoveTaskError results, causing tasks to be moved instead of crashing.

func WorkerRenewal added in v0.1.3

func WorkerRenewal(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

WorkerRenewal tests that task claims are renewed periodically for longer-running work tasks.

func WorkerRetryOnError added in v0.4.3

func WorkerRetryOnError(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

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

type Dialer func() (net.Conn, error)

Dialer returns a net connection.

func StartService

func StartService(ctx context.Context, opener entroq.BackendOpener) (*grpc.Server, Dialer, error)

StartService starts an in-memory gRPC network service and returns a function for creating client connections to it.

type Tester added in v0.4.3

type Tester func(ctx context.Context, t *testing.T, client *entroq.EntroQ, qPrefix string)

Tester runs a test helper, all of which these test functions are.

Jump to

Keyboard shortcuts

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