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 TestOwner(t *testing.T, ctor func(string) workqueue.Interface)
- func TestSemantics(t *testing.T, ctor func(int) workqueue.Interface)
- func TestTenantFairness(t *testing.T, ...)
- 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
func TestTenantFairness ¶ added in v0.11.63
func TestTenantFairness(t *testing.T, ctor func(limit int, tenant workqueue.TenantFunc) workqueue.Interface)
TestTenantFairness checks the ordering of a queue constructed with a TenantFunc. ctor receives the enumeration limit and the TenantFunc, which assigns each key to the segment of its name before the first "/".
The scenario is a single tenant flooding one priority: tenant "a" holds 1,000 keys at priority 100 when tenant "b" queues one newer key at the same priority. Ordered by creation time alone, b's key would sit behind all of a's and never be enumerated.
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