Documentation ¶
Overview ¶
Package testbed is a tool for running redis-server for tests.
Index ¶
- Variables
- func InitDir(base string)
- func RmDir()
- type Cluster
- func (cl *Cluster) AttemptFailover()
- func (cl *Cluster) CancelMoveSlot(slot int)
- func (cl *Cluster) ClusterOk() bool
- func (cl *Cluster) FinishMoveSlot(slot, from, to int)
- func (cl *Cluster) InitMoveSlot(slot, from, to int)
- func (cl *Cluster) MoveSlot(slot, from, to int)
- func (cl *Cluster) Start()
- func (cl *Cluster) StartSeventhNode()
- func (cl *Cluster) Stop()
- func (cl *Cluster) StopSeventhNode()
- func (cl *Cluster) WaitClusterOk()
- type Node
- type Server
- func (s *Server) Addr() string
- func (s *Server) Do(cmd string, args ...interface{}) interface{}
- func (s *Server) DoSure(cmd string, args ...interface{}) interface{}
- func (s *Server) Pause()
- func (s *Server) PortStr() string
- func (s *Server) Resume()
- func (s *Server) Running() bool
- func (s *Server) RunningNow() bool
- func (s *Server) Start()
- func (s *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
var Binary = func() string { p, _ := exec.LookPath("redis-server"); return p }()
Binary is a path to redis-server
var Dir = ""
Dir is temporary directory where redis will run.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct {
Node []Node
}
Cluster is a tool for starting/stopping redis cluster for tests.
func NewCluster ¶
NewCluster instantiate cluster of 6 nodes (3 masters and 3 slaves). Master are on ports startport, startport+1, startport+2, and slaves are on ports startport+3, startport+4, startport+5
func (*Cluster) AttemptFailover ¶
func (cl *Cluster) AttemptFailover()
AttemptFailover tries to issue CLUSTER FAILOVER FORCE to slaves of falled masters. This is work around replication bug present in Redis till 4.0.9 (including)
func (*Cluster) CancelMoveSlot ¶
CancelMoveSlot resets slot migration.
func (*Cluster) FinishMoveSlot ¶
FinishMoveSlot finalizes slot migration
func (*Cluster) InitMoveSlot ¶
InitMoveSlot issues start for slot migration.
func (*Cluster) StartSeventhNode ¶
func (cl *Cluster) StartSeventhNode()
StartSeventhNode start additional node
func (*Cluster) StopSeventhNode ¶
func (cl *Cluster) StopSeventhNode()
StopSeventhNode stops additional node
func (*Cluster) WaitClusterOk ¶
func (cl *Cluster) WaitClusterOk()
WaitClusterOk wait for cluster configuration to be stable.
type Node ¶
Node is wrapper for Server with its NodeId
type Server ¶
Server is a handle for running redis-server.
func (*Server) RunningNow ¶
RunningNow returns true if server should be running and it is not paused (with SIGSTOP).