@Test
public void testAutoRemediationRateLimit() throws Exception {

    final InputStream mockOutput = new ByteArrayInputStream("".getBytes());
    instanceState.setShouldCassandraBeAlive(true);
    instanceState.markLastAttemptedStartTime();
    new Expectations() {
        {
            // 6 calls to execute should = 12 calls to getInputStream();
            mockProcess.getInputStream();
            result = mockOutput;
            times = 12;
            cassProcess.start(true);
            times = 2;
        }
    };
    // Mock out the ps call
    final Runtime r = Runtime.getRuntime();
    String[] cmd = {
        "/bin/sh",
        "-c",
        "ps -ef |grep -v -P \"\\sgrep\\s\" | grep " + config.getCassProcessName()
    };
    new Expectations(r) {
        {
            r.exec(cmd);
            result = mockProcess;
        }
    };
    // Sleep ahead to ensure we have permits in the rate limiter
    monitor.execute();
    Thread.sleep(1500);
    monitor.execute();
    monitor.execute();
    Thread.sleep(1500);
    monitor.execute();
    monitor.execute();
    monitor.execute();
    new Verifications() {};
}