Testing distributed systems is hard. Testing is hard, but we’ve been given tools like EUnit and common_test to make it easier. Where is this toolkit for distributed systems? I’m not going to claim that I have all the answers or even that I have a framework you can use to solve your problem. What I do have is an idea and a solution to MY problem, which is “”How do we test Riak?”
Come with me on an adventure of design decisions, tradeoffs and deep dark corners of Erlang. We’ll go from group leaders to lager and port commands to cookies. By journey’s end you’ll have an understand of how we’re able to test riak, how you may be able to build off what we’ve done to test your distributed system, and hopefully ideas on how we might, together, make riak_test generic enough to be that distributed testing tool we’ve been looking for.
Riak_test is not a conventional Erlang application. It doesn’t use supervisors and is at its core, an escript. This talk hopes to bring attention to features of Erlang and how they can be used to test an Erlang application. This talk hopes to explore corner cases of Erlang features, that are most likely not being used as intended to test an erlang application. Some of the more interesting things I’ll show off are:
* How we simulate a network partition
* How we are able to test console interaction
* Using group_leader to capture all kinds of output
* Using a custom lager backend for keeping logs in memory
* Using module attributes to check for test prerequisites
I also hope to drum up more interest in riak_test from outside of Basho, in an effort to make it a more generic framework for testing distributed systems.
Target audience: I think even people with a lot of Erlang experience will be able to get something out of this talk, even if that is just a new perspective on old material. New users will get to see some of these features explored, giving them something else to think about besides list comprehensions, gen_servers and supervision trees. Developers new and old alike will be exposed to the issues faced in testing a distributed system, and will hopefully consider those in the future as they write code that will, one day, need testing.