We are heavy users of Apache Cassandra and most of our projects depend on her. We also strive to have our code thoroughly covered by unittests. Consequently large number of unittests in our projects depends on Cassandra. Initially we just set up a test instance of Cassandra and use her in our unittests. But with increased number of unittests, they have started to take increasingly more time since they have to access a remote Cassandra server. One solution to this problem could be to mock all functions that access Cassandra, but this would require a lot of additional code that would be hard to maintain. Therefore we've chosen to speed-up Cassandra performance instead. For Java, there exists a nice library called cassandra-unit that wraps the whole Cassandra in such a way that she can be embedded in unittests and schema loaded from local file. This is perfect for unittests since each unittest can be made entirely self-reliant. But we are mostly a Python shop so we couldn't readily use cassandra-unit in our projects. That is why our colleague Hamax wrote a very nice Python wrapper for cassandra-unit that can be used to embed Cassandra in Python unittests. You're very much welcome to check out pysandra-unit yourself and, preferably, also contribute towards this project.

Enhanced by Zemanta