scheduleconformance

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package scheduleconformance provides a shared conformance test suite for the port.ScheduleStore interface (scheduled-tasks issue #189, Phase 1b). Adapters (the in-memory reference memschedulestore, a future JSONL store, the gRPC driver client over bufconn, the k8s-backed store) 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

func Run(t *testing.T, newStore func(t *testing.T) port.ScheduleStore)

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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