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 ¶
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.