conformance

package
v0.8.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: 10 Imported by: 0

Documentation

Overview

Package conformance verifies evt.Repository implementations against backend-neutral guarantees: ordering, entity isolation, snapshots, filtering, and optional optimistic concurrency.

Run the suite with a fresh repository factory and SuiteOptions for optional guarantees. Cases namespace IDs and types so durable backends may share a store across subtests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunRepositorySuite

func RunRepositorySuite(t *testing.T, newRepo func() evt.Repository, opts SuiteOptions)

RunRepositorySuite runs the full backend-neutral contract suite against the repository produced by newRepo. newRepo MUST return a fresh repository on each call; for an in-memory backend that means an empty store, while a shared durable backend may return a handle to the same table (the suite namespaces its data so that is safe).

Types

type SuiteOptions

type SuiteOptions struct {
	// EnforcesOptimisticConcurrency indicates the backend rejects a second commit that reuses an
	// already-committed (entityID, sequence) pair. Durable backends enforce this with a conditional
	// write (DynamoDB) or a unique constraint (SQL); the in-memory test double does not, so it
	// leaves this false and the concurrency assertion is skipped.
	EnforcesOptimisticConcurrency bool

	// SupportsSnapshots indicates the backend implements CommitWithSnapshot and GetSnapshot durably.
	// Both the in-memory and DynamoDB backends do; a minimal backend may leave it false to skip the
	// snapshot assertions.
	SupportsSnapshots bool
}

SuiteOptions toggles assertions that only some backends provide. The zero value runs only the guarantees every Repository must satisfy.

Jump to

Keyboard shortcuts

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