pythonunit-testingcassandracqlengine

Testing the service with Cassandra ORM models


I've got the service that uses Cassandra models to store some data, I create custom connection and so on, but I do not use it explicitly, as I use ORM provided by cqlengine, it implicitly creates sessions and executes queries.

The question is about proper way of unit- and functional- testing for this stuff.

Previously, I had mock of another storage and it acted as local storage instance, but I did not find anything similar for Cassandra's ORM (cqlengine). Tessting.cassandra and cassandramock are both appropriate only for native cassandra-driver queries.

Is there any proper way to test my logic that relies on CQLEngine without running Cassandra instance (because it breaks unit-test ideology)?


Solution

  • Is there any proper way to test my logic that relies on CQLEngine without running Cassandra instance (because it breaks unit-test ideology)?

    I found that mocking database layer is too hard to implementation and support, and better solution is using Cassndra Unit and run embeded Cassandra for unit tests.

    For python I found a wrapper for Cassandra Unit: Pysandra Unit