use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierTest method testTooManyArgs.
@Test
public void testTooManyArgs() {
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, "another arg", "system_schema", "tables");
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Too many arguments"));
assertEquals(1, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierTest method testDebugArg.
@Test
public void testDebugArg() {
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, "--debug", "system_schema", "tables");
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("debug=true"));
Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
assertCorrectEnvPostTest();
tool.assertOnCleanExit();
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierTest method testMaybeChangeDocs.
@Test
public void testMaybeChangeDocs() {
// If you added, modified options or help, please update docs if necessary
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, "-h");
String help = "usage: sstableverify [options] <keyspace> <column_family>\n" + "--\n" + "Verify the sstable for the provided table.\n" + "--\n" + "Options are:\n" + " -c,--check_version make sure sstables are the latest version\n" + " --debug display stack traces\n" + " -e,--extended extended verification\n" + " -h,--help display this help message\n" + " -q,--quick do a quick check, don't read all data\n" + " -r,--mutate_repair_status don't mutate repair status\n" + " -t,--token_range <range> long token range of the format left,right.\n" + " This may be provided multiple times to define multiple different ranges\n" + " -v,--verbose verbose output\n";
Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierTest method testWrongArgFailsAndPrintsHelp.
@Test
public void testWrongArgFailsAndPrintsHelp() {
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, "--debugwrong", "system_schema", "tables");
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Unrecognized option"));
assertEquals(1, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class ToolsEnvsConfigsTest method testJDKEnvInfoDefaultCleaners.
// Some JDK can output env info on stdout/err. Check we can clean them
@SuppressWarnings("resource")
@Test
public void testJDKEnvInfoDefaultCleaners() {
ToolResult tool = ToolRunner.invoke(ImmutableMap.of("_JAVA_OPTIONS", "-Djava.net.preferIPv4Stack=true"), null, CQLTester.buildNodetoolArgs(Collections.emptyList()));
assertTrue("Cleaned Stderr was not empty: " + tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
}
Aggregations