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 ¶
- func TestBackoffDelay(t *testing.T, ctor func(int) workqueue.Interface)
- func TestConcurrency(t *testing.T, ctor func(int) workqueue.Interface)
- func TestDurability(t *testing.T, ctor func(int) workqueue.Interface)
- func TestMaxRetry(t *testing.T, ctor func(int) workqueue.Interface)
- func TestSemantics(t *testing.T, ctor func(int) workqueue.Interface)
- type ExpectedState
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestBackoffDelay ¶ added in v0.7.14
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 TestDurability ¶
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 ¶
TestMaxRetry tests the max retry functionality with Fail method
Types ¶
type ExpectedState ¶
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