storetest

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package storetest runs the store-independent behavioral conformance suite of Credbound: the same Manager-level flows executed against every store implementation, so a divergence between the in-memory and PostgreSQL backends fails a test instead of reaching production.

The root package's own tests exercise the Manager against the in-memory store only. Store packages, symmetrically, test their port contract without ever building a Manager. This suite closes the gap: it asserts the business semantics a host observes — ordering, cursor stability, atomicity, revocation cascades, audit chaining, timestamp persistence — through the public API, where a SQL dialect difference actually shows up.

A store package registers itself with a Factory returning a fresh, empty store per call:

func TestConformance(t *testing.T) {
	storetest.Run(t, storetest.Factory{Name: "postgresql", New: newStore})
}

Nothing here is safe outside tests: the managers it builds use the deterministic doubles of credboundtest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, factory Factory)

Run executes the conformance suite against the store built by factory.

Types

type Factory

type Factory struct {
	// Name labels the implementation in test output.
	Name string
	// New returns a fresh, empty store.
	New func(t *testing.T) credbound.Store
}

Factory builds the store under test. New must return an empty, isolated store, and register any cleanup with t.Cleanup. The suite calls it exactly once per flow, so an implementation backed by a single shared database — as the PostgreSQL one is — may reset that database on every call.

Jump to

Keyboard shortcuts

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