|
@@ -43,6 +43,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
|
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
|
|
+import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
|
|
|
public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
@@ -87,7 +88,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
// make sure the cluster state is green, and all has been recovered
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().setWaitForNodes(">=2").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().setWaitForNodes(">=2"));
|
|
|
|
|
|
logger.info("--> waiting for {} docs to be indexed ...", totalNumDocs);
|
|
|
waitForDocs(totalNumDocs, indexer);
|
|
@@ -140,7 +141,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
allowNodes("test", 4);
|
|
|
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().setWaitForNodes(">=4").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().setWaitForNodes(">=4"));
|
|
|
|
|
|
|
|
|
logger.info("--> waiting for {} docs to be indexed ...", totalNumDocs);
|
|
@@ -195,7 +196,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
allowNodes("test", 4);
|
|
|
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().setWaitForNodes(">=4").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().setWaitForNodes(">=4"));
|
|
|
|
|
|
|
|
|
logger.info("--> waiting for {} docs to be indexed ...", totalNumDocs);
|
|
@@ -207,23 +208,23 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
logger.info("--> allow 3 nodes for index [test] ...");
|
|
|
allowNodes("test", 3);
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().setWaitForNodes(">=3").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().setWaitForNodes(">=3"));
|
|
|
|
|
|
logger.info("--> allow 2 nodes for index [test] ...");
|
|
|
allowNodes("test", 2);
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().setWaitForNodes(">=2").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().setWaitForNodes(">=2"));
|
|
|
|
|
|
logger.info("--> allow 1 nodes for index [test] ...");
|
|
|
allowNodes("test", 1);
|
|
|
logger.info("--> waiting for YELLOW health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForYellowStatus().setWaitForNodes(">=1").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForYellowStatus().setWaitForNodes(">=1"));
|
|
|
|
|
|
logger.info("--> marking and waiting for indexing threads to stop ...");
|
|
|
indexer.stop();
|
|
|
logger.info("--> indexing threads stopped");
|
|
|
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForYellowStatus().setWaitForNodes(">=1").execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForYellowStatus().setWaitForNodes(">=1"));
|
|
|
|
|
|
logger.info("--> refreshing the index");
|
|
|
refreshAndAssert();
|
|
@@ -254,7 +255,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
allowNodes = 2 / allowNodes;
|
|
|
allowNodes("test", allowNodes);
|
|
|
logger.info("--> waiting for GREEN health status ...");
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForGreenStatus().execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus());
|
|
|
}
|
|
|
|
|
|
logger.info("--> marking and waiting for indexing threads to stop ...");
|
|
@@ -264,7 +265,7 @@ public class RecoveryWhileUnderLoadTests extends ElasticsearchIntegrationTest {
|
|
|
logger.info("--> bump up number of replicas to 1 and allow all nodes to hold the index");
|
|
|
allowNodes("test", 3);
|
|
|
assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("number_of_replicas", 1)).get());
|
|
|
- assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus().execute().actionGet().isTimedOut(), equalTo(false));
|
|
|
+ assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("5m").setWaitForGreenStatus());
|
|
|
|
|
|
logger.info("--> refreshing the index");
|
|
|
refreshAndAssert();
|