@Test
public void testSingleNodeOffline() throws Exception {
// 1. Get the node that we're going to take down...
String offlineHostName = getRandomHostName();
Node offlineNode = getNodeByHostName(offlineHostName, failureDetector);
// 2. Hit the stores enough that we can reasonably assume that they're
// up and reachable.
test(store);
assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
assertTrue(failureDetector.isAvailable(offlineNode));
// 3. Stop our node, then test enough that we can cause the node to be
// marked as unavailable...
stopClusterNode(offlineHostName, ec2FailureDetectorTestConfig);
test(store);
assertEquals(hostNamePairs.size() - 1, failureDetector.getAvailableNodeCount());
assertFalse(failureDetector.isAvailable(offlineNode));
// 4. Now start the node up, test, and make sure everything's OK.
startClusterNode(offlineHostName, ec2FailureDetectorTestConfig, offlineNode.getId());
failureDetector.waitForAvailability(offlineNode);
test(store);
assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
assertTrue(failureDetector.isAvailable(offlineNode));
}