[rspec-users] Redis and RSpec: Redis returning wildly inconsistent results

Rob Watson rfwatson at gmail.com
Mon Jan 17 17:14:06 EST 2011

Hi list

I use Redis heavily in my application, and perform all of my unit testing
using RSpec. So very often during my tests, I am hitting Redis repeatedly.

I find that Redis repeatedly returns inconsistent and unexpected values for
keys in my test environment. So every time I run a suite of specs, a few of
them fail, seemingly randomly. The specs are usually very simple, and often
just testing the contents of simple string keys in Redis. The results *seem*
like they might come from a different object or instance variable of the
same type/name: so they're always seemingly valid values, but don't actually
relate to the spec currently being performed. So the spec fails.

This is really reducing the value of my tests, because I can never tell if
they're really failing or not without digging into them.

I've tried all sorts of things to fix this so far, including setting the
:thread_safe option for Redis in my test environment (no difference), and
forcing a reconnection to Redis before each suite of specs (no difference).

I'm pretty sure this is a problem with the connection between RSpec and
Redis, or some kind of threading issue, but I can't be 100% sure even of
that. I'm at a little bit of a loss.

Anybody experienced anything similar?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110117/39c97833/attachment.html>

More information about the rspec-users mailing list