eventlogconformance

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Overview

Package eventlogconformance provides a shared conformance test suite for the port.EventLog interface. Adapters (the local JSONL replay store, the in-memory sibling, remote drivers, ...) call Run with a factory that constructs a fresh event log, and the suite exercises only the port.EventLog interface against events built through the session package's public 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. testing/fstest and the sibling storeconformance/memconformance packages).

The suite pins the CONTRACT, not the implementation: on-disk layout, the envelope format tag, and the encoding are adapter-internal and deliberately NOT asserted here. It is the SAME suite the local jsonlstore 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newLog func(t *testing.T) port.EventLog)

Run executes the shared EventLog conformance table against the log produced by newLog. newLog must return a fresh, isolated log each call.

func RunCursor

func RunCursor(t *testing.T, s CursorSuite)

RunCursor executes the shared CursorEventLog conformance table.

Types

type CursorSuite

type CursorSuite struct {
	// New returns a fresh, isolated cursor log.
	New func(t *testing.T) port.CursorEventLog

	// Reset replaces the positional basis of id's log, as deleting the session
	// and recording a new one under the same id would.
	//
	// It is REQUIRED rather than optional because the guarantee it proves is the
	// one a positional cursor cannot provide by itself: without a generation, a
	// cursor into a rebuilt log does not fail, it silently addresses a DIFFERENT
	// record. A backend that cannot express "the basis moved" cannot honestly
	// claim to implement this port.
	Reset func(t *testing.T, log port.CursorEventLog, id session.SessionID)

	// SkipCrossProcess opts a backend out of the durability subtest that requires
	// a second reader over independent state. memstore is the only legitimate
	// user: a second process shares no memory with it, so the obligation is
	// meaningless there rather than unmet.
	SkipCrossProcess bool

	// NewPair returns two INDEPENDENTLY CONSTRUCTED handles over the SAME
	// durable state — the in-process stand-in for two replicas sharing a store.
	//
	// It is required unless SkipCrossProcess is set. Reusing New twice would not
	// do: New returns an ISOLATED log, so a cross-reader subtest built on it
	// would pass trivially against a backend that shares nothing, which is the
	// exact failure it exists to catch.
	NewPair func(t *testing.T) (writer, reader port.CursorEventLog)
}

CursorSuite parameterises the cursor conformance run.

Jump to

Keyboard shortcuts

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