Search in sources :

Example 76 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SetGetColumnIndexSizeTest method assertGetThroughput.

private static void assertGetThroughput(int expected) {
    ToolResult tool = invokeNodetool("getcolumnindexsize");
    tool.assertOnCleanExit();
    assertThat(tool.getStdout()).contains("Current value for column_index_size: " + expected + " KiB");
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 77 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SetGetEntireSSTableStreamThroughputTest method assertSetInvalidThroughput.

private static void assertSetInvalidThroughput(String throughput, String expectedErrorMessage) {
    ToolResult tool = throughput == null ? invokeNodetool("setstreamthroughput", "-e") : invokeNodetool("setstreamthroughput", "-e", throughput);
    assertThat(tool.getExitCode()).isEqualTo(1);
    assertThat(tool.getStdout()).contains(expectedErrorMessage);
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 78 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SetGetStreamThroughputTest method assertSetGetValidThroughput.

private static void assertSetGetValidThroughput(int throughput, double rateInBytes) {
    ToolResult tool = invokeNodetool("setstreamthroughput", String.valueOf(throughput));
    tool.assertOnCleanExit();
    assertThat(tool.getStdout()).isEmpty();
    assertGetThroughput(throughput);
    assertThat(StreamRateLimiter.getRateLimiterRateInBytes()).isEqualTo(rateInBytes, withPrecision(0.04));
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 79 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class NodeProbeTest method testCheckJobs.

/**
 * Verify that nodetool -j/--jobs option warning is raised depending on the value of
 * {@link org.apache.cassandra.config.Config#concurrent_compactors} in the target node, independently of where the
 * tool is used.
 *
 * Before CASSANDRA-16104 the warning was based on the local value of {@code concurrent_compactors}, and not in the
 * value used in the target node, which is got through JMX.
 */
@Test
public void testCheckJobs() {
    int compactors = probe.getConcurrentCompactors();
    int jobs = compactors + 1;
    // Verify that trying to use more jobs than configured concurrent compactors prints a warning
    ToolResult toolResult = ToolRunner.invokeNodetool("upgradesstables", "-j", String.valueOf(jobs));
    toolResult.assertOnCleanExit();
    assertThat(toolResult.getStdout()).contains(format("jobs (%d) is bigger than configured concurrent_compactors (%d) on the host, using at most %d threads", jobs, compactors, compactors));
    // Increase the number of concurrent compactors and verify that the new number of concurrent compactors is seen
    // by subsequent validations
    assertToolResult(ToolRunner.invokeNodetool("setconcurrentcompactors", String.valueOf(jobs)));
    assertToolResult(ToolRunner.invokeNodetool("upgradesstables", "-j", String.valueOf(jobs)));
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 80 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SSTableExpiredBlockersTest method testNoArgsPrintsHelp.

@Test
public void testNoArgsPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(SSTableExpiredBlockers.class);
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
    assertNoUnexpectedThreadsStarted(null);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Aggregations

ToolResult (org.apache.cassandra.tools.ToolRunner.ToolResult)123 Test (org.junit.Test)102 File (org.apache.cassandra.io.util.File)4 NoHostAvailableException (com.datastax.driver.core.exceptions.NoHostAvailableException)3 RandomAccessFile (java.io.RandomAccessFile)3 LegacySSTableTest (org.apache.cassandra.io.sstable.LegacySSTableTest)3 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)2 Session (com.datastax.driver.core.Session)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)1 Keyspace (org.apache.cassandra.db.Keyspace)1 Cluster (org.apache.cassandra.distributed.Cluster)1 IInvokableInstance (org.apache.cassandra.distributed.api.IInvokableInstance)1 Ignore (org.junit.Ignore)1