[ https://issues.apache.org/jira/browse/CASSANDRA-7466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Ellis updated CASSANDRA-7466: -------------------------------------- Reviewer: Aleksey Yeschenko (was: Joshua McKenzie) > 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 > Assignee: Caleb William Rackliffe > Priority: Minor > Labels: unit-test > Attachments: trunk-7466.txt > > > 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. > You can run the suite with IDEA's class/method forking, and you get a little > bit better results, but it still seems like this shouldn't be necessary. > I guess there are two ways to fix it: > 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)