jeudi 30 juin 2016

Running Cassandra unit tests in parallel using nose, ccm, python


I've recently started using Cassandra as a primary data store, and am trying to write unit tests for this using CCM

I'm able to spin up a Cassandra Cluster instance and test one test class. I want to be able to test another test class in parallel with this, as serial unit testing can take really long, with more test cases added. My test code looks something like -

class BaseTestCase(TestCase):
  def setUp(self):
    super(BaseTestCase, self).setUp()

    # Create and start a CCM (Cassandra Cluster Management) cluster
    self.cluster = ccmlib.cluster.Cluster() # with reqd params
    self.cluster.populate(1).start()  # Start cluster with 1 node

Now when I have more than 1 test class inheriting from this Base class, and I run the tests serially, it works fine. But when I run nosetests in parallel, I get errors along the lines of "A Cassandra instance may already be running". I've tried looking into Dtests but this doesn't seem to solve my problem. It seems that it can run tests across clusters, but not in parallel.

I was wondering if there is anything that someone can point me to, for this purpose, or if anyone thinks I'm doing something incorrect with the usage of CCM or Dtests. Thanks!


Aucun commentaire:

Enregistrer un commentaire