storetest

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package storetest is the conformance suite every websub.SubscriptionStore implementation must pass.

A hub trusts its store completely: if the store drops a subscription, the subscriber silently stops receiving content, and if it returns a stale one the hub delivers to a callback that unsubscribed. None of that shows up in the hub's own tests, so it has to be caught here.

func TestStore(t *testing.T) {
	storetest.Run(t, func(t *testing.T) websub.SubscriptionStore {
		return newStoreForTest(t)
	})
}

Run it under -race. Several cases are concurrent on purpose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newStore NewStore)

Run executes the full suite.

Types

type NewStore

type NewStore func(t *testing.T) websub.SubscriptionStore

NewStore returns a store to test. It is called once per case with an empty store, and must register its own cleanup.

Backends that cannot cheaply create an isolated instance per case should return one that is namespaced, for example by a random key prefix or schema, rather than one shared across cases. The suite runs cases in parallel and assumes it has the store to itself.

Jump to

Keyboard shortcuts

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