Documentation
¶
Overview ¶
Package leaseconformance provides a shared conformance test suite for the port.SessionLease interface. Adapters (the in-memory reference, the single-host flock lease, the gRPC driver client over bufconn, the k8s lease) call Run with a factory that constructs a fresh lease plus an advance callback that drives the lease's notion of time past its TTL, and the suite exercises only the port.SessionLease interface through the port's value types.
Importing "testing" in a non-_test.go file is intentional here: this is a test-helper package whose sole purpose is to be imported by adapter tests, the conventional Go pattern for shared conformance suites (cf. the sibling eventlogconformance/storeconformance packages).
The suite pins the CONTRACT, not the implementation: how the lease stores its records (a map, a record file, a coordination.k8s.io Lease object) is adapter-internal and deliberately NOT asserted here. It is the SAME suite the reference memlease and the gRPC driver client (over bufconn) both pass — the dual-path contract-unification: the Go port is the contract, the wire is one adapter.
TIME: the suite never sleeps. It expresses "the lease lapsed" by calling the factory-supplied advance(d) callback, which pushes the lease's injected clock (or, for a real-clock adapter, the real TTL window) forward by d. A fake-clock adapter advances instantly; a real-clock adapter may implement advance as a short real sleep over a small TTL.
Index ¶
Constants ¶
const TTL = 30 * time.Second
TTL is the lease lifetime the factory MUST construct its lease with, so the suite's advance(TTL+ε) calls reliably cross the expiry boundary.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.