use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class CassandrastressTest method testNoArgsPrintsHelp.
@Test
public void testNoArgsPrintsHelp() {
ToolResult tool = ToolRunner.invokeCassandraStress();
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
assertTrue("Tool stderr: " + tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
assertEquals(1, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class CassandrastressTest method invokeAndAssertCleanExit.
void invokeAndAssertCleanExit(String[] baseArgs, String... extraArgs) {
String[] args = Arrays.copyOf(baseArgs, baseArgs.length + extraArgs.length);
System.arraycopy(extraArgs, 0, args, baseArgs.length, extraArgs.length);
ToolResult tool = ToolRunner.invokeCassandraStress(args);
tool.assertOnCleanExit();
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierOnSSTablesTest method testCorruptStatsFile.
@Test
public void testCorruptStatsFile() throws Exception {
String keyspaceName = "StandaloneVerifierTestCorruptStatsKs";
String corruptStatsTable = "corruptStatsTable";
createAndPopulateTable(keyspaceName, corruptStatsTable, cfs -> {
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (RandomAccessFile file = new RandomAccessFile(sstable.descriptor.filenameFor(Component.STATS), "rw")) {
file.seek(0);
file.writeBytes(StringUtils.repeat('z', 2));
}
});
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, keyspaceName, corruptStatsTable);
assertEquals(1, tool.getExitCode());
Assertions.assertThat(tool.getStderr()).contains("Error Loading", corruptStatsTable);
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneScrubberTest method testHelpArg.
@Test
public void testHelpArg() {
Arrays.asList("-h", "--help").forEach(arg -> {
ToolResult tool = ToolRunner.invokeClass(StandaloneScrubber.class, arg);
assertThat("Arg: [" + arg + "]", tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
tool.assertOnExitCode();
assertCorrectEnvPostTest();
});
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneScrubberTest method testDefaultCall.
@Test
public void testDefaultCall() {
ToolResult tool = ToolRunner.invokeClass(StandaloneScrubber.class, "system_schema", "tables");
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("Pre-scrub sstables snapshotted into snapshot"));
Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
assertEquals(0, tool.getExitCode());
assertCorrectEnvPostTest();
}
Aggregations