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

storetest

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package storetest provides a backend-agnostic conformance suite for the store.Store interface. Every backend (memory, sqlite, postgres, mongo) is expected to pass the same contract tests, so behavioral drift between implementations is caught automatically rather than shipped.

Run it from each backend's test package:

func TestConformance(t *testing.T) {
    storetest.RunConformance(t, func(t *testing.T) store.Store { ... })
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunConformance

func RunConformance(t *testing.T, newStore Factory, skip ...string)

RunConformance runs every contract test against stores produced by newStore.

skip names cases the backend does not yet implement. Each is still registered as a subtest and calls t.Skip from inside it, so a skipped case shows up in `go test -v` output rather than silently not existing.

func SeedUser

func SeedUser(t *testing.T, s store.Store, tn Tenant, email string) id.UserID

SeedUser creates a user under tn and returns its id. Plugin tables that reference authsome_users need a real row here, not a synthetic id.

Types

type Factory

type Factory func(t *testing.T) store.Store

Factory creates a fresh, empty, migrated store for a single test.

type Tenant

type Tenant struct {
	AppID id.AppID
	EnvID id.EnvironmentID
}

Tenant is an app plus its default environment: the parent rows that every FK-enforcing backend needs in place before app-scoped rows can be written.

func SeedTenant

func SeedTenant(t *testing.T, s store.Store) Tenant

SeedTenant creates an app and its default environment in s. Plugin conformance suites use it so their rows can satisfy the foreign keys the SQL backends declare against authsome_apps and authsome_environments.

Jump to

Keyboard shortcuts

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