conformance

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 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 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 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