storetest

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package storetest runs a test against every keysmith store backend that is available. Memory and sqlite always run. Postgres runs when KEYSMITH_TEST_PG_DSN is set and mongo when KEYSMITH_TEST_MONGO_URI is set; `make test-backends` sets both.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each

func Each(t *testing.T, fn func(t *testing.T, s store.Store))

Each runs fn once per available backend, each with a fresh migrated store.

func Name

func Name(t *testing.T) string

Name returns the backend name of the subtest t is running in: the last path element of the test name, such as "sqlite".

func OpenSQLite

func OpenSQLite(t *testing.T) store.Store

OpenSQLite opens an unmigrated sqlite store in a fresh temporary directory, with the DSN the store documents.

The engine's ValidateKey writes last_used_at from a goroutine nobody waits for, and on sqlite that write can still be waiting for the write lock when the test ends. If it outlives the cleanup it reopens the WAL files after the directory is emptied, and the temporary directory fails to remove. So the store this returns counts those writes, and the cleanup refuses new ones and waits for the rest before it closes the database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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