Help us shape the future of Go! Take the 2026 Go Developer Survey

eventstoretest

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package eventstoretest checks that an audit.EventStore keeps the contract the event trail builds on: contiguous, append-only positions per run, an idempotent re-append of the same leaf, a refusal (audit.ErrSeqTaken) of a different leaf at a stored position, and exactly one winner among writers racing for one position. Every EventStore in this repository runs it, and a new backend should too:

func TestEventStore(t *testing.T) {
    db := openTestDatabase(t)
    eventstoretest.Run(t, func(t *testing.T) audit.EventStore { return myEventStoreOn(db) })
}

open may be called several times in one test; every handle it returns must reach the same data (a new connection to the same database, or the same in-memory store), since the suite checks what one handle's writes look like through another and races appends across handles. Run IDs are unique per call, so the suite can run repeatedly against a persistent backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, open func(t *testing.T) audit.EventStore)

Run runs the whole suite against the stores open returns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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