Documentation
¶
Overview ¶
Package apikeytest is the shared contract suite for core.APIKeyAdmin, the optional interface for listing every API key and deleting the expired ones. Each backend runs RunAdmin with a factory that returns a fresh, empty store.
Index ¶
- func RunAdmin(t *testing.T, factory Factory)
- func TestCleanupDeletesExpiredRevokedOrNot(t *testing.T, factory Factory)
- func TestCleanupHonorsNow(t *testing.T, factory Factory)
- func TestCleanupIsRepeatable(t *testing.T, factory Factory)
- func TestListDuringCleanup(t *testing.T, factory Factory)
- func TestListEmpty(t *testing.T, factory Factory)
- func TestListEverySubjectWithoutHashes(t *testing.T, factory Factory)
- type Backend
- type Factory
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestCleanupDeletesExpiredRevokedOrNot ¶
TestCleanupDeletesExpiredRevokedOrNot: cleanup deletes every expired key, revoked or not, and keeps live keys and keys with no expiry, even a revoked one.
func TestCleanupHonorsNow ¶
TestCleanupHonorsNow: cleanup measures expiry against req.Now, not the wall clock, and a key expiring exactly at Now is expired.
func TestCleanupIsRepeatable ¶
TestCleanupIsRepeatable: a second cleanup at the same Now removes 0.
func TestListDuringCleanup ¶
TestListDuringCleanup: a cleanup on one handle deletes keys while another handle lists. No listing fails, and none returns a deleted key half-read. Agni hit an error here on fs (agni issue 1796).
func TestListEmpty ¶
TestListEmpty: an empty store lists no keys and no error.
func TestListEverySubjectWithoutHashes ¶
TestListEverySubjectWithoutHashes: the listing covers every subject, and no listed key carries its bcrypt hash.
Types ¶
type Backend ¶
Backend is one fresh, empty store. Reopen returns a second handle on the same data, the way another process would see it. For fs that's a store with its own mutex on the same directory.
type Store ¶
type Store interface {
core.APIKeyStore
core.APIKeyAdmin
}
Store is an APIKeyStore that also implements APIKeyAdmin.