Help us shape the future of Go! Take the 2026 Go Developer Survey

queuetest

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package queuetest is the conformance suite for queue drivers:

queuetest.Run(t, driver, queuetest.Options{Pending: driver.Pending, Advance: clock.Add})

Memory and database run it in core, Redis in drivers/redis.

See https://github.com/AlexGalhardo/vukem/blob/main/docs/subsystems.md#queue.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, d queue.Driver, o Options)

Run executes the suite. The driver must start empty; subtests run in order.

Example

A driver runs the suite from one test function. Pending counts stored jobs; Advance (nil here) moves the driver's clock to test abandoned reservations.

package main

import (
	"testing"

	"github.com/AlexGalhardo/vukem/queue"
	"github.com/AlexGalhardo/vukem/queue/queuetest"
)

func main() {
	_ = func(t *testing.T) {
		t.Helper()

		var driver queue.Driver = queue.NewMemory()
		queuetest.Run(t, driver, queuetest.Options{})
	}
}

Types

type Options

type Options struct {
	// Pending counts stored jobs (waiting or running).
	Pending func(ctx context.Context) (int, error)
	// Advance moves the driver's clock forward; nil skips the test of
	// abandoned reservations.
	Advance func(d time.Duration)
}

Options describe the driver under test.

Jump to

Keyboard shortcuts

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