Redsync, one of my open-source Go packages, implements a distributed lock using Redis. It is an implementation of the Redlock algorithm.
This Go package has tests that run against multiple real Redis servers. And it is an example of how you can use the
TestMain function to customize your Go tests.
TestMain function, if defined in your Go tests, will allow you to run the Go code before and after the actual tests, which is really ideal for setup and teardown work.
In the case of Redsync, the
TestMain function is where multiple Redis servers spawn before running the tests. A Go package,
tempredis, makes it easy to start Redis servers without having to muck around with
When any tests run in this package,
servers will have instances of
comments powered by Disqus