You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Caleb William Rackliffe (JIRA)" <ji...@apache.org> on 2014/06/28 08:42:24 UTC

[jira] [Created] (CASSANDRA-7466) Unit Test Suite Breaks when Run in a Single JVM

Caleb William Rackliffe created CASSANDRA-7466:
--------------------------------------------------

             Summary: Unit Test Suite Breaks when Run in a Single JVM
                 Key: CASSANDRA-7466
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7466
             Project: Cassandra
          Issue Type: Bug
          Components: Tests
         Environment: MacOS 10.9.3, IntelliJ IDEA 13.1.3, Java 1.7.0_51
            Reporter: Caleb William Rackliffe
            Priority: Minor


Note: Instead of picking a version below, I'll simply note that I'm on {{trunk}} at commit {{c027183ea4e901cf1d44e06704f6d78f84405bb4}}

I pulled down the source and followed http://wiki.apache.org/cassandra/RunningCassandraInIDEA to import C* as an IDEA project. Everything in the tutorial works as it should, but when I tried to run the unit tests in {{test/unit/org.apache.cassandra}}, the suite failed a couple tests in, complaining that it couldn't find the {{system}} keyspace in {{build/test/cassandra/data"".

tl;dr static initialization makes it hard to run the unit tests in the same JVM

The full story is that...
1.) When the first test in the suite is run, the {{system}} keyspace is created on disk and in the in-memory schema.
2.) Many subsequent tests, like {{BlacklistingCompactionsTest}}, remove the {{system}} keyspace directory (among other things) in {{defineSchema()}} with a call to {{SchemaLoader.prepareServer()}}.
3.) While these tests create the keyspaces they require, they do *not* recreate the system keyspace, and so they fail when they force a compaction or perform any other action that goes looking for it.

I guess there are two ways to fix this:
1.) We rebuild the system keyspace before for each test.
2.) We leave the system keyspace alone.

I took a hack at #1 in the attached patch. It looks like it to fixes this specific problem, but I'm not super-believable in this codebase yet...



--
This message was sent by Atlassian JIRA
(v6.2#6252)