test

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupKeys

func CleanupKeys(ctx context.Context, client *redis.Client, namespace string) error

CleanupKeys deletes all Redis keys matching "{namespace}:*" using SCAN + DEL.

func NewRedisClient

func NewRedisClient() *redis.Client

NewRedisClient creates a Redis client for testing. Reads REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_USE_TLS env vars. Falls back to REDIS_URL for backward compatibility. Defaults to localhost:6379 without password or TLS.

func PendingCount

func PendingCount(ctx context.Context, client *redis.Client, stream, group string) (int64, error)

PendingCount returns the number of pending messages for a stream+group.

func UniqueNamespace

func UniqueNamespace(t *testing.T, client *redis.Client) string

UniqueNamespace returns a test-scoped namespace like "test-TestName-1707000000-abc123". Registers a cleanup function to delete all keys with this prefix.

func WaitFor

func WaitFor(t *testing.T, condition func() bool, timeout time.Duration)

WaitFor polls condition every 100ms until it returns true or timeout expires.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL