storetest

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package storetest is the conformance suite every registry.Store must pass. A store's own tests call Run with a constructor:

func TestConformance(t *testing.T) {
	storetest.Run(t, func() registry.Store { return newStore() })
}

It checks the transition table, that exactly one version is active, that a referenced version is not retired, the compare-and-set behaviour of advancing and re-wrapping data keys, that the cap is never over-granted under concurrency, paging, and that returned records are copies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newStore func() registry.Store)

Run runs every case as a subtest, each against a store from newStore.

Types

type Case

type Case struct {
	Name string
	Run  func(t TB, s registry.Store)
}

Case is one conformance check. It runs against a fresh store.

func Cases

func Cases() []Case

Cases returns the conformance cases.

type TB

type TB interface {
	Helper()
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
	Logf(format string, args ...any)
}

TB is the part of testing.TB the suite uses, so the suite can also run against a recorder to show that it rejects a broken store.

Jump to

Keyboard shortcuts

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