storetest

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package storetest is the conformance suite for wardn.Store implementations, and their benchmark suite (Bench). A store that passes the conformance suite behaves correctly and securely with wardn:

func TestMyStore(t *testing.T) {
	storetest.Run(t, func(t *testing.T) wardn.Store {
		return mystore.New(...) // a new, empty store
	})
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bench

func Bench(b *testing.B, newStore func(b *testing.B) wardn.Store)

Bench runs wardn's benchmarks against a store. newStore must return a new, empty store; it is called once.

The data is a bank with 4 organisations, 40 regions, 1,000 branches and about 20,000 assignments. Each check is a full permission check through a Warden, as an application makes it, so the numbers include wardn's evaluation and every store read it needs:

func BenchmarkMyStore(b *testing.B) {
	storetest.Bench(b, func(b *testing.B) wardn.Store { return mystore.New(...) })
}

Seeding takes a few seconds on a database server; run with -run '^$'.

func Run

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

Run runs the conformance suite. newStore must return a new, empty store each time it is called; it may use t for cleanup.

Types

This section is empty.

Jump to

Keyboard shortcuts

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