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 ¶
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{})
}
}
Output:
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.
Click to show internal directories.
Click to hide internal directories.