use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierOnSSTablesTest method testWorkingDataFile.
@Test
public void testWorkingDataFile() throws Exception {
String keyspaceName = "StandaloneVerifierTestWorkingDataKs";
String workingTable = "workingTable";
createAndPopulateTable(keyspaceName, workingTable, x -> {
});
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, keyspaceName, workingTable);
assertEquals(0, tool.getExitCode());
tool.assertOnCleanExit();
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneVerifierOnSSTablesTest method testCheckVersionValidVersion.
@Test
public void testCheckVersionValidVersion() throws Exception {
String keyspaceName = "StandaloneVerifierTestCheckVersionWorking";
String workingTable = "workingCheckTable";
createAndPopulateTable(keyspaceName, workingTable, x -> {
});
ToolResult tool = ToolRunner.invokeClass(StandaloneVerifier.class, keyspaceName, workingTable, "-c");
assertEquals(0, tool.getExitCode());
tool.assertOnCleanExit();
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneScrubberTest method testWrongArgFailsAndPrintsHelp.
@Test
public void testWrongArgFailsAndPrintsHelp() {
ToolResult tool = ToolRunner.invokeClass(StandaloneScrubber.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 StandaloneSplitterWithCQLTesterTest method testNoSnapshotOption.
@Test
public void testNoSnapshotOption() throws Throwable {
ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, "-s", "1", "--no-snapshot", sstableFileName);
assertTrue(origSstables.size() < Arrays.asList(sstablesDir.tryList()).size());
assertTrue(tool.getStdout(), tool.getStdout().isEmpty());
assertTrue(tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
assertEquals(0, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneSplitterWithCQLTesterTest method testSplittingMultipleSSTables.
@Test
public void testSplittingMultipleSSTables() throws Throwable {
ArrayList<String> args = new ArrayList<>(Arrays.asList("-s", "1"));
args.addAll(Arrays.asList(sstablesDir.tryList()).stream().map(f -> f.absolutePath()).collect(Collectors.toList()));
ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, args.toArray(new String[args.size()]));
List<File> splitFiles = Arrays.asList(sstablesDir.tryList());
splitFiles.stream().forEach(f -> {
if (f.name().endsWith("Data.db") && !origSstables.contains(f))
assertTrue(f.name() + " is way bigger than 1MiB: [" + f.length() + "] bytes", // give a 20% margin on size check
f.length() <= 1024 * 1024 * 1.2);
});
assertTrue(origSstables.size() < splitFiles.size());
assertTrue(tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
assertEquals(0, tool.getExitCode());
}
Aggregations