Documentation
¶
Overview ¶
Package redistest is a small Redis server for tests. It speaks enough RESP2 to answer the commands a client sends, including a pipeline and a MULTI/EXEC transaction. It is not a Redis implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler answers one user command. args[0] is the command name as the client sent it. Built-in commands (HELLO, AUTH, SELECT, PING, QUIT, MULTI, EXEC, DISCARD) are not passed to the handler.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a running fake server.
func StartTLSConfig ¶ added in v0.8.0
StartTLSConfig is Start behind the given TLS config. The URL is rediss://.
func StartWithPassword ¶
StartWithPassword is Start, and HELLO or AUTH must present password. A wrong password is a Redis error that does not contain the password.
func (*Server) CloseAfterUserCommands ¶
CloseAfterUserCommands closes the connection after n user commands have been read, without writing a reply. Setup commands do not count. n is counted per connection.
func (*Server) Commands ¶
Commands are the user commands received, in order, without HELLO, AUTH or SELECT. MULTI and EXEC are included. Each entry is the argument list.
func (*Server) DisableHello ¶
func (s *Server) DisableHello()
DisableHello makes HELLO answer with an unknown-command error, so a client falls back to AUTH and SELECT.
type Value ¶
Value is one RESP reply.
func ErrorString ¶
ErrorString is an error reply. s should start with the code word, such as "ERR something".