storetest

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storetest is a conformance suite for store implementations.

Every store shipped with the library runs it, and so should yours:

func TestSessions(t *testing.T) {
    storetest.Sessions(t, func(t *testing.T) session.Store { return newMyStore(t) })
}

Each factory call must return an empty store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InviteManager added in v2.4.0

func InviteManager(t *testing.T, newStore func(t *testing.T) ManagedInviteStore)

InviteManager runs the invite.Manager conformance tests.

func Invites

func Invites(t *testing.T, newStore func(t *testing.T) invite.Store)

Invites runs the invite.Store conformance tests.

func Limiter added in v2.4.0

func Limiter(t *testing.T, newLimiter func(t *testing.T, cfg ratelimit.Config) ratelimit.Limiter)

Limiter runs the ratelimit.Limiter conformance tests: the semantics of ratelimit.Memory, which every shared limiter must match. newLimiter must return a limiter built from cfg (whose Now is a test clock) with no recorded failures.

func MFA added in v2.2.0

func MFA(t *testing.T, newStore func(t *testing.T) mfa.Store)

MFA runs the mfa.Store conformance tests.

func Passkeys added in v2.2.0

func Passkeys(t *testing.T, newStore func(t *testing.T) passkey.Store)

Passkeys runs the passkey.Store conformance tests.

func Purger added in v2.3.0

func Purger(t *testing.T, newStore func(t *testing.T) PurgingSessionStore)

Purger runs the session.Purger conformance tests.

func Sessions

func Sessions(t *testing.T, newStore func(t *testing.T) session.Store)

Sessions runs the session.Store conformance tests.

func Tokens added in v2.2.0

func Tokens(t *testing.T, newStore func(t *testing.T) onetime.Store)

Tokens runs the onetime.Store conformance tests.

func Users

func Users(t *testing.T, newStore func(t *testing.T) UserStore)

Users runs the iam.UserStore and password.CredentialStore conformance tests. If the store implements iam.SubjectDeleter, that is tested too.

func UsersWith added in v2.1.0

func UsersWith(t *testing.T, newStore func(t *testing.T) UserStore, opts UsersOptions)

UsersWith runs the Users suite with options.

Types

type ManagedInviteStore added in v2.4.0

type ManagedInviteStore interface {
	invite.Store
	invite.Manager
}

ManagedInviteStore is what InviteManager needs.

type PurgingSessionStore added in v2.3.0

type PurgingSessionStore interface {
	session.Store
	session.Purger
}

PurgingSessionStore is what Purger needs.

type UserStore

type UserStore interface {
	iam.UserStore
	password.CredentialStore
}

UserStore is what Users needs: subjects, identities and credentials.

type UsersOptions added in v2.1.0

type UsersOptions struct {
	// Roles are granted to the first subject the suite creates, and must be
	// returned by LoadSubject, in any order. Default: editor, reader.
	// Set it for stores that allow one role per subject, or only known roles.
	Roles []string

	// DefaultRoles are granted to the second subject (an empty grant by
	// default). Set it for stores that require at least one role.
	DefaultRoles []string
}

UsersOptions adapts the Users suite to stores with stricter rules than IAM requires. The zero value is the default suite.

Jump to

Keyboard shortcuts

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