use of org.apache.cassandra.utils.KillerForTests in project cassandra by apache.
the class CommitLogFailurePolicyTest method testCommitFailurePolicy_die.
@Test
public void testCommitFailurePolicy_die() {
CassandraDaemon daemon = new CassandraDaemon();
//startup must be completed, otherwise commit log failure must kill JVM regardless of failure policy
daemon.completeSetup();
StorageService.instance.registerDaemon(daemon);
KillerForTests killerForTests = new KillerForTests();
JVMStabilityInspector.Killer originalKiller = JVMStabilityInspector.replaceKiller(killerForTests);
Config.CommitFailurePolicy oldPolicy = DatabaseDescriptor.getCommitFailurePolicy();
try {
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.die);
CommitLog.handleCommitError("Testing die policy", new Throwable());
Assert.assertTrue(killerForTests.wasKilled());
//only killed quietly on startup failure
Assert.assertFalse(killerForTests.wasKilledQuietly());
} finally {
DatabaseDescriptor.setCommitFailurePolicy(oldPolicy);
JVMStabilityInspector.replaceKiller(originalKiller);
}
}
use of org.apache.cassandra.utils.KillerForTests in project cassandra by apache.
the class CommitLogReaderTest method beforeClass.
@BeforeClass
public static void beforeClass() {
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.ignore);
JVMStabilityInspector.replaceKiller(new KillerForTests(false));
}
Aggregations