Categorygithub.com/rubenv/redistest
repositorypackage
0.0.0-20210618070525-bdb6e551d330
Repository: https://github.com/rubenv/redistest.git
Documentation: pkg.go.dev

# README

redistest

Go library to spawn single-use Redis servers for unit testing

Build Status Build Status GoDoc

Spawns a Redis server. Ideal for unit tests where you want a clean instance each time. Then clean up afterwards.

Features:

  • Starts a clean isolated Redis database
  • Tested on Fedora, Ubuntu and Alpine
  • Optimized for in-memory execution, to speed up unit tests
  • Less than 0.1 second startup / initialization time

Usage

In your unit test:

red, err := redistest.Start()
defer red.Stop()

// Do something with red.Pool (which is a *redis.Pool)

License

This library is distributed under the MIT license.