Unit testing, Riak buckets

Toby Corkindale toby.corkindale at strategicdata.com.au
Sun Oct 13 21:27:59 EDT 2013


Hi,
I'd like to hear how other people are approaching the problem of 
cleaning Riak buckets up at the end of unit tests for their apps.

The problem I have is that multiple tests may be run at once (by 
different developers or different Jenkins' jobs or even just a 
parallelised test suite) so I can't really run a blanket delete-all at 
the end of the test suite, unless I use a randomly-named bucket each 
time. Yet if I do that, I'm concerned the test suite may crash out prior 
to the end sometimes, and then never delete that randomly-named bucket.


If secondary indexes aren't required, then the easy solution is to use a 
randomly-named Bitcask bucket which has a backend configured for a 
fairly short TTL.


Otherwise, I have wondered about creating buckets with a certain format, 
perhaps "test-XXXXXX-YYYY-MM-DD", (x=random) and then a nightly cron 
script can run to find all buckets timestamped from the previous day or 
earlier, and remove them. I gather listing all buckets is an expensive 
operation though, although it'll only be running on a testing Riak cluster.


So I wondered how other developers are approaching this issue?


Cheers,
Toby




More information about the riak-users mailing list