Fork me on GitHub
#testing
<
2016-02-17
>
genRaiy19:02:10

hi guys, any good resources on testing with core.async?

annapawlicka21:02:36

hi folks! what suggestions do you have for avoiding race conditions in tests? e.g. something is being saved into the database and the test is failing because the read returns nothing. it’s a case of “save and forget”, write doesn’t return anything. I don’t want to add Thread/sleep everywhere..

bensu22:02:40

@annapawlicka: I'm not sure I follow, the write is fire and forget, the test continues, tries to read, but the write is not yet done?

annapawlicka22:02:07

yup, pretty much. usually it’s done by that time as writes in cassandra are very fast, but sometimes there’s an odd case when they’re not

bensu22:02:56

my only ideas are to a) make a synchronous version of write for testing purposes (the cassandra's api might have it)

bensu22:02:27

b) retry the read if nil (once should do it, right?)

bensu22:02:35

c) use Thread/sleep

bensu22:02:44

I'm sorry this is not too helpful

annapawlicka22:02:55

i’ll try the first two. thanks for tips!