Documentation
¶
Overview ¶
Package redis provides opt-in Redis acceptance helpers. Passing tests remove only their own registered key prefixes after application shutdown. Failed or panicking tests retain them, as does FOUNDRY_TEST_KEEP_REDIS_KEYS=1. No helper flushes a shared store. Callers must use unique test-owned namespaces.
Index ¶
Constants ¶
const ( AddressVariable = "FOUNDRY_TEST_REDIS_ADDR" RequiredVariable = "FOUNDRY_TEST_REDIS_REQUIRED" UserVariable = "FOUNDRY_TEST_REDIS_USER" PasswordVariable = "FOUNDRY_TEST_REDIS_PASSWORD" )
const KeepKeysVariable = rediscleanup.KeepKeysVariable
KeepKeysVariable retains keys even after a passing test when set to "1".
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶ added in v0.25.0
func Cleanup(t testing.TB, inventory []infrastructure.RedisConnectionInventory)
Cleanup registers removal of this test's exact application key inventory. All connections must use Config(t)'s endpoint. Channels are not keys and are ignored. Call before Build or opening clients so application shutdown runs first. Use unique test-owned namespaces; failure, panic or KeepKeysVariable=1 retains them.
func CleanupNamespace ¶ added in v0.25.0
CleanupNamespace registers removal of exact feature prefixes in a test-owned namespace. Include every feature that writes keys, including cache.NamespaceKeyFeature for caches. Call before opening clients. It follows the same retention rule as Cleanup.
func Config ¶
Config reads the explicitly opted-in plaintext endpoint (host:port) over the default client limits, plus the optional UserVariable and PasswordVariable credentials. Each is read independently: a password alone authenticates Redis's default user. The password is kept in a secret-bearing field and is never logged. Ordinary test runs skip without the address; the required acceptance command fails if it is missing.
Types ¶
This section is empty.