Fork me on GitHub
#test-check
<
2019-01-27
>
dangercoder13:01:52

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.

dangercoder13:01:01

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

gfredericks13:01:58

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

gfredericks13:01:13

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

gfredericks13:01:55

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

hiredman16:01:13

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.

gfredericks17:01:56

@hiredman did you find bugs in redis?

hiredman18:01:41

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