diff --git a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java index 173e2802ff8..dddd3efa5c3 100644 --- a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java +++ b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java @@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -129,12 +130,13 @@ public class SearchWhileRelocatingTests extends ElasticsearchIntegrationTest { } allowNodes("test", between(1, 3)); client().admin().cluster().prepareReroute().get(); - ClusterHealthResponse resp = client().admin().cluster().prepareHealth().setWaitForRelocatingShards(0).execute().actionGet(); + // this might time out on some machines if they are really busy and you hit lots of throttling + ClusterHealthResponse resp = client().admin().cluster().prepareHealth().setWaitForRelocatingShards(0).setTimeout("5m").get(); stop.set(true); for (int j = 0; j < threads.length; j++) { threads[j].join(); } - assertThat(resp.isTimedOut(), equalTo(false)); + assertNoTimeout(resp); if (!thrownExceptions.isEmpty() || !nonCriticalExceptions.isEmpty()) { Client client = client(); boolean postSearchOK = true; diff --git a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java index 054f6c3da7c..2bf52575104 100644 --- a/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java +++ b/src/test/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java @@ -81,7 +81,7 @@ public class ElasticsearchAssertions { } public static void assertNoTimeout(ClusterHealthResponse response) { - assertThat("ClusterHealthResponse has timed out", response.isTimedOut(), is(false)); + assertThat("ClusterHealthResponse has timed out - returned status: [" + response.getStatus() + "]", response.isTimedOut(), is(false)); } public static void assertAcked(AcknowledgedResponse response) {