}
@Test(timeout = 50000)
public void testNodeFailure() throws Exception {
deployTestIndices(1, getNodeCount());
final LuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo:bar");
assertEquals(4, client.count(query, new String[] { INDEX_NAME }));
// kill 1st of 3 nodes
_miniCluster.shutdownNode(0);
assertEquals(4, client.count(query, new String[] { INDEX_NAME }));
// kill 2nd of 3 nodes
_miniCluster.shutdownNode(0);
assertEquals(4, client.count(query, new String[] { INDEX_NAME }));
// add a 4th node
Node node4 = _miniCluster.startAdditionalNode();
TestUtil.waitUntilNodeServesShards(_protocol, node4.getName(), SHARD_COUNT);
assertEquals(4, client.count(query, new String[] { INDEX_NAME }));
// kill 3rd node
Thread.sleep(5000);
_miniCluster.shutdownNode(0);
assertEquals(4, client.count(query, new String[] { INDEX_NAME }));
}