coordtest

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package coordtest is the behavior every coord.Coordinator must share, as one suite each implementation runs against its own backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conformance

func Conformance(t *testing.T, newPair Factory, opts ...Option)

Conformance runs the shared suite: exclusivity, token monotonicity, Resign lets the other in, loss closes Done, Close resigns, ctx cancellation.

Types

type Factory

type Factory func(t *testing.T) (a, b coord.Coordinator)

Factory returns two coordinators over one fresh backend, as two processes would hold them. Conformance closes both when each case ends.

type Option

type Option func(*options)

Option adjusts the suite to what a backend can do.

func WithLoss

func WithLoss(lose func(t *testing.T, name string)) Option

WithLoss is how the backend ends the live term of name out from under its holder, as a lost renewal or a takeover would. Without it the loss case is skipped: an in-process lease is never lost.

func WithWait

func WithWait(d time.Duration) Option

WithWait bounds how long the suite waits for something the backend does asynchronously, such as noticing a loss. Default 2s.

Jump to

Keyboard shortcuts

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