use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class NodeToolTest method testCaptureConsoleOutput.
@Test
public void testCaptureConsoleOutput() {
NodeToolResult ringResult = NODE.nodetoolResult("ring");
ringResult.asserts().stdoutContains("Datacenter: datacenter0");
ringResult.asserts().stdoutContains("127.0.0.1 rack0 Up Normal");
assertEquals("Non-empty error output", "", ringResult.getStderr());
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class NodeToolTest method testSetCacheCapacityWhenDisabled.
@Test
public void testSetCacheCapacityWhenDisabled() throws Throwable {
try (ICluster cluster = init(builder().withNodes(1).withConfig(c -> c.set("row_cache_size", "0MiB")).start())) {
NodeToolResult ringResult = cluster.get(1).nodetoolResult("setcachecapacity", "1", "1", "1");
ringResult.asserts().stderrContains("is not permitted as this cache is disabled");
}
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method missingKeyspace.
@Test
public void missingKeyspace() {
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
// as of this moment the check is done in nodetool so the JMX notifications are not imporant
// nor is the history stored
long repairExceptions = getRepairExceptions(CLUSTER, 2);
NodeToolResult result = repair(2, "doesnotexist");
result.asserts().failure().errorContains("Keyspace [doesnotexist] does not exist.");
Assert.assertEquals(repairExceptions, getRepairExceptions(CLUSTER, 2));
assertParentRepairNotExist(CLUSTER, "doesnotexist");
});
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method unknownHost.
@Test
public void unknownHost() {
String table = tableName("unknownhost");
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
CLUSTER.schemaChange(format("CREATE TABLE %s.%s (key text, value text, PRIMARY KEY (key))", KEYSPACE, table));
long repairExceptions = getRepairExceptions(CLUSTER, 2);
NodeToolResult result = repair(2, KEYSPACE, table, "--in-hosts", "thisreally.should.not.exist.apache.org");
result.asserts().failure().errorContains("Unknown host specified thisreally.should.not.exist.apache.org");
if (withNotifications) {
result.asserts().notificationContains(ProgressEventType.START, "Starting repair command").notificationContains(ProgressEventType.START, "repairing keyspace " + KEYSPACE + " with repair options").notificationContains(ProgressEventType.ERROR, "Unknown host specified thisreally.should.not.exist.apache.org").notificationContains(ProgressEventType.COMPLETE, "finished with error");
}
assertParentRepairNotExist(CLUSTER, KEYSPACE, table);
Assert.assertEquals(repairExceptions + 1, getRepairExceptions(CLUSTER, 2));
});
}
use of org.apache.cassandra.distributed.api.NodeToolResult in project cassandra by apache.
the class RepairCoordinatorFast method noTablesToRepair.
@Test
public void noTablesToRepair() {
// index CF currently don't support repair, so they get dropped when listed
// this is done in this test to cause the keyspace to have 0 tables to repair, which causes repair to no-op
// early and skip.
String table = tableName("withindex");
assertTimeoutPreemptively(Duration.ofMinutes(1), () -> {
CLUSTER.schemaChange(format("CREATE TABLE %s.%s (key text, value text, PRIMARY KEY (key))", KEYSPACE, table));
CLUSTER.schemaChange(format("CREATE INDEX value_%s ON %s.%s (value)", postfix(), KEYSPACE, table));
long repairExceptions = getRepairExceptions(CLUSTER, 2);
// if CF has a . in it, it is assumed to be a 2i which rejects repairs
NodeToolResult result = repair(2, KEYSPACE, table + ".value");
result.asserts().success();
if (withNotifications) {
result.asserts().notificationContains("Empty keyspace").notificationContains("skipping repair: " + KEYSPACE).notificationContains(ProgressEventType.SUCCESS, // will fail since success isn't returned; only complete
"Empty keyspace").notificationContains(ProgressEventType.COMPLETE, // will fail since it doesn't do this
"finished");
}
assertParentRepairNotExist(CLUSTER, KEYSPACE, table + ".value");
// this is actually a SKIP and not a FAILURE, so shouldn't increment
Assert.assertEquals(repairExceptions, getRepairExceptions(CLUSTER, 2));
});
}
Aggregations