Documentation ¶
Index ¶
- func FakeMetricsServer(handler redis.Handler, timeout time.Duration) (srv *redis.Server, addr string)
- func FakeServer(handler redis.Handler) (srv *redis.Server, url string)
- func FakeServerList() (validServers redis.ServerList, brokenServers redis.ServerList, ...)
- func FakeTimeoutServer(handler redis.Handler, timeout time.Duration) (srv *redis.Server, addr string)
- func ReadTestPattern(client *redis.Client, total int, templ string, sleep int, ...) (numHits int, numMisses int, numErrors int, err error)
- func TestClient(t *testing.T, makeClient MakeClient)
- func TestServer(serverList redis.ServerList, ...) <-chan struct{}
- func TestServerHandler() redis.HandlerFunc
- func TestServerRegistry(t *testing.T, makeServerRegistry MakeServerRegistry)
- func WriteTestPattern(client *redis.Client, n int, templ string, sleep int, timeout time.Duration) (numSuccess int, numFailure int, err error)
- type Client
- type MakeClient
- type MakeServerRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FakeMetricsServer ¶ added in v1.6.3
func FakeServer ¶ added in v1.4.0
func FakeServer(handler redis.Handler) (srv *redis.Server, url string)
func FakeServerList ¶ added in v1.4.0
func FakeServerList() (validServers redis.ServerList, brokenServers redis.ServerList, oneDownServers []redis.ServerList)
func FakeTimeoutServer ¶ added in v1.4.0
func ReadTestPattern ¶ added in v1.0.0
func ReadTestPattern(client *redis.Client, total int, templ string, sleep int, timeout time.Duration) (numHits int, numMisses int, numErrors int, err error)
ReadTestPattern reads a test pattern (previously wrote using WriteTestPattern) from a Redis client and returns hit statistics.
func TestClient ¶
func TestClient(t *testing.T, makeClient MakeClient)
TestClient is a test suite which verifies the behavior of redis clients.
func TestServer ¶ added in v1.2.0
func TestServer(serverList redis.ServerList, handlers ...func(w redis.ResponseWriter, r *redis.Request)) <-chan struct{}
func TestServerHandler ¶ added in v1.2.0
func TestServerHandler() redis.HandlerFunc
func TestServerRegistry ¶
func TestServerRegistry(t *testing.T, makeServerRegistry MakeServerRegistry)
TestServerRegistry is a test suite which verifies the behavior of ServerRegistry implementations.
func WriteTestPattern ¶ added in v1.0.0
func WriteTestPattern(client *redis.Client, n int, templ string, sleep int, timeout time.Duration) (numSuccess int, numFailure int, err error)
WriteTestPattern writes a test pattern to a Redis client. The objective is to read the test pattern back at a later stage using ReadTestPattern.
Types ¶
type Client ¶
type Client interface { Exec(context.Context, string, ...interface{}) error Query(context.Context, string, ...interface{}) redis.Args Subscribe(context.Context, ...string) (*redis.SubConn, error) PSubscribe(context.Context, ...string) (*redis.SubConn, error) }
Client is an interface that must be implemented by types that represent redis clients and wish to be tested using the TestClient test suite.
type MakeClient ¶
MakeClient is the type of factory functions that the TestClient test suite uses to create Clients to run the tests against.
type MakeServerRegistry ¶
MakeServerRegistry is the type of factory functions that the TestServerRegistry test suite uses to create Clients to run the tests against.