Fork me on GitHub

Do you guys use any external stateful things like a database (Redis) or do you create simulators for all of it? Lets say you want to create property based tests for a sequence of function calls that uses Redis.


I was thinking of just having a redis-test-instance and then I will "Clean" it after all tests are done running.


yeah you'd want to effectively reset the database as part of your trial


I've certainly done that before you can find bugs in your database that way 🙂


but having to reset something in a different process can definitely lead to fairly slow tests, so you have to have some tolerance for that


a year (maybe two?) ago we switched out the redis library we used at work, and I took all the operations we did using an old redis library and defined them as a protocol, then implemented that protocol on a concurrent hashmap and on the new redis library, then I wrote the thunderdome, which would take a generated list of redis operations and two things that satisfied the redis protocol and run those operations against them comparing the results.


@hiredman did you find bugs in redis?


I did not, I wasn't really exercising redis, the kind of api layer I pulled out, we aren't (weren't?) using redis all that much, but I wanted to make sure the operations behaved the same when moving from a higher level library (lots of built in serialization magic) to a lower level library (doing all the serialization ourselves). I think the protocol I ended up defining to encapsulate our redis use was maybe 4 functions