Documentation
¶
Overview ¶
Package redistest keeps each test that runs against a live redis inside a key prefix of its own.
`go test ./...` runs packages in parallel, and two checkouts can run against the same redis at once. A redis store sees every key under its prefix: Migrate walks them all and the indexes are one set per prefix. So each test store gets a fresh prefix through store/redis.WithKeyPrefix, and deletes only that prefix when it ends.
Index ¶
Constants ¶
const Root = "chronicle:"
Root is the prefix every key a test writes starts with. It matches store/redis.DefaultKeyPrefix, which this package can't import: the redis package's own tests import this one.
Variables ¶
This section is empty.
Functions ¶
func Isolate ¶
Isolate returns a key prefix under Root that no other test uses, and deletes every key under it when t ends. Pass the result to store/redis.WithKeyPrefix.
Before handing it back, it refuses (t.Fatalf) a database holding any key outside Root. On the machine these tests were written on, the DSN a developer reaches for first (localhost:6379) is another project's live redis. The guard and the prefix-scoped delete are independent, so neither one failing can empty it. dsn is only used to name the database in that message, without its password.
Types ¶
This section is empty.