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

conformance

package
v0.11.47 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package conformance provides a suite of conformance tests for workqueue implementations.

Use TestSemantics and TestConcurrency to verify that a workqueue.Interface implementation satisfies the expected behavioral contracts.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestBackoffDelay added in v0.7.14

func TestBackoffDelay(t *testing.T, ctor func(int) workqueue.Interface)

TestBackoffDelay verifies the Options.BackoffDelay failure-retry primitive: it defers a requeued key by the given duration, preserves the attempt count (unlike Options.Delay, which resets it), and applies regardless of priority.

func TestConcurrency

func TestConcurrency(t *testing.T, ctor func(int) workqueue.Interface)

func TestDurability

func TestDurability(t *testing.T, ctor func(int) workqueue.Interface)

Unlike the other tests, this one is only expected for implementations that have some degree of durability. For instance, the in-memory implementation will not pass this test.

func TestMaxRetry

func TestMaxRetry(t *testing.T, ctor func(int) workqueue.Interface)

TestMaxRetry tests the max retry functionality with Fail method

func TestOwner added in v0.10.19

func TestOwner(t *testing.T, ctor func(string) workqueue.Interface)

func TestSemantics

func TestSemantics(t *testing.T, ctor func(int) workqueue.Interface)

Types

type ExpectedState

type ExpectedState struct {
	WorkInProgress []string
	Queued         []string
}
Example

ExampleExpectedState demonstrates constructing an ExpectedState value used by the conformance suite to assert queue contents.

package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/workqueue/conformance"
)

func main() {
	es := conformance.ExpectedState{
		WorkInProgress: []string{"key-a"},
		Queued:         []string{"key-b", "key-c"},
	}
	fmt.Printf("wip=%d queued=%d\n", len(es.WorkInProgress), len(es.Queued))
}
Output:
wip=1 queued=2

Jump to

Keyboard shortcuts

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