Easy way to unit test projects using redigo library (Redis client in go)
Easy way to unit test projects using redigo library (Redis client in go)
Easy way to unit test projects using redigo library (Redis client in go). You can find the latest release here.
go get -u github.com/rafaeljusto/redigomock/v3Here is an example of using redigomock, for more information please check the API documentation.
……// Note you cannot get access to the connection via the pool,
// the only way is to use this conn variable.
conn := redigomock.NewConn()
pool := &redis.Pool{
// Return the same connection mock for each Get() call.
Dial: func() (redis.Conn, error) { return conn, nil },
MaxIdle: 10,
}Sometimes you need to check the executed arguments in your Redis command. For that you can use the command handler.
…No open issues yet, or sync has not completed.