storetest

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package storetest is the behavioral contract shared by every review store. It is test support: production packages must not import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run[S Store](t *testing.T, harness Harness[S])

Run verifies every shared content and review rule against the harness's stores.

Types

type Harness

type Harness[S Store] struct {
	Open   func(t *testing.T, retention time.Duration) S
	Owner  func(t *testing.T, store S, name string) string             // creates an owner, returns its ID
	Expire func(t *testing.T, store S, contextID string, at time.Time) // sets expiry of every diff of the context (scopes and commits)
	// Reopen closes store and opens its database again with retention, so
	// durability and retention changes are observable.
	Reopen func(t *testing.T, store S, retention time.Duration) S
	// Submitted sets the context's last submission time, so a retry that
	// refreshes it is observable within one clock tick.
	Submitted func(t *testing.T, store S, contextID string, at time.Time)
}

Harness opens isolated stores and performs test-only adjustments no application operation may perform.

type Store

Store is every shared content and review operation both review stores implement.

Jump to

Keyboard shortcuts

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