Documentation
¶
Index ¶
- func CockroachDBBackend(t *testing.T) (connStr string, backend string)
- func MongoDBBackend(t *testing.T) (connStr string, backend string)
- func PostgresBackend(t *testing.T) (connStr string, backend string)
- func RedisClient(t *testing.T) *redis.Client
- func RedisClientRaw(t *testing.T) *redis.Client
- func RedisClusterClient(t *testing.T) *redis.Client
- type MongoRSInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CockroachDBBackend ¶ added in v0.2.0
CockroachDBBackend starts a shared single-node CockroachDB container (once per test binary) and returns the admin connection string and host:port backend address.
func MongoDBBackend ¶ added in v0.6.3
MongoDBBackend starts a shared MongoDB 8 container with authentication enabled (once per test binary) and returns the admin connection string and host:port backend address.
func PostgresBackend ¶
PostgresBackend starts a shared PostgreSQL 16-alpine container (once per test binary) and returns the admin connection string and host:port backend address.
func RedisClient ¶
RedisClient starts a shared Redis 7-alpine container (once per test binary) and returns a connected client. The client is closed when the test finishes.
func RedisClientRaw ¶
RedisClientRaw returns the shared Redis client without flushing. Use this when you need to manipulate Redis state mid-test without losing data set by prior operations in the same test.
func RedisClusterClient ¶ added in v0.6.0
RedisClusterClient starts a single-node Redis in cluster mode (once per test binary) and returns a connected client. The server enforces cluster hash slot semantics, so multi-key Lua scripts operating across different slots will fail with CROSSSLOT errors — exactly like a production Redis Cluster would.
Types ¶
type MongoRSInfo ¶ added in v0.6.3
type MongoRSInfo struct {
ConnStr string // mongodb://admin:adminpass@host1:port1,host2:port2,host3:port3/?replicaSet=rs0&authSource=admin
Primary string // host:port of the primary (mapped port on host)
Members []string // all member host:port addresses (mapped ports on host)
}
MongoRSInfo contains connection info for a multi-node MongoDB replica set.
func MongoDBReplicaSet ¶ added in v0.6.3
func MongoDBReplicaSet(t *testing.T) *MongoRSInfo
MongoDBReplicaSet starts a shared 3-node MongoDB replica set (once per test binary) and returns connection info. The RS uses auth with admin/adminpass. Each call cleans up provisioned users and non-system databases for isolation.