Documentation
¶
Overview ¶
Package scheduleconformance provides a shared conformance test suite for the port.ScheduleStore interface (scheduled-tasks issue #189). Adapters (the in-memory reference memschedulestore, the JSONL and Redis stores, and the gRPC driver client over bufconn) call Run with a factory that constructs a fresh store, and the suite exercises only the port.ScheduleStore 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 leaseconformance/storeconformance/eventlogconformance packages).
The suite pins the CONTRACT, not the implementation: how the store persists its records (a map, a JSONL sidecar, a CRD, a remote table) is adapter-internal and deliberately NOT asserted here. It is the SAME suite the reference memschedulestore and a future gRPC driver client (over bufconn) both pass — the dual-path contract-unification: the Go port is the contract, the wire is one adapter. This is the SECOND adapter-validation pattern after leases (leaseconformance), and mirrors its discipline byte-for-byte.
TIME: the suite never sleeps. Every port.ScheduleStore method takes `now` as an explicit argument, so the suite expresses "the schedule is now due" / "the slot was missed" by passing explicit time.Time values to Due/Claim — no clock, no advance callback.
CRON: the store is parser-free (Claim's nextFire is caller-computed), but the suite is a test-helper package and IS allowed to import engine/adapter/cronparse to compute the next-fire values it hands to Claim. The memschedulestore reference adapter does NOT import cronparse — the suite's use of it here does not bind the adapter.
MISFIRE: the store does NOT implement misfire policy — MisfireSkip / MisfireFireOnceNow are read by COMPOSITION at tick time from ScheduleSpec.Misfire, not by the store. The store's Due returns any schedule whose NextFireAt <= now regardless of Misfire; the policy decides whether composition calls Claim. The suite therefore does NOT test MisfireSkip at the store level (it is not a store concern). It DOES test the MisfireFireOnceNow STORE-level consequence: a past-due slot, when Claimed, advances NextFireAt to the NEXT future fire (computed from `now`, not the stale past NextFireAt) — the catch-up semantics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the shared ScheduleStore conformance table against the store produced by newStore. newStore returns a fresh, isolated store. Every port.ScheduleStore method takes `now` as an explicit argument, so the suite controls time DIRECTLY by passing time.Time values to Due/Claim — there is no clock to advance, and the factory needs no advance callback.
func RunClaimAndRetryConformance ¶ added in v0.17.0
RunClaimAndRetryConformance executes the complete ScheduleStore suite with claim and retry safety checks. Claim atomically reserves a schedule occurrence in the store; rearm re-enables a failed one-shot for retry. The checks cover stored scheduling records only. They do not launch or stop an executor. newStore must return a fresh, isolated store for each test case.
Run retains the legacy expectations for stores that have not adopted these checks. The two entry points share the common suite and differ only where legacy expectations conflict with claim and retry safety.
Types ¶
This section is empty.