From 81e86eba6e13b8c517a4a96e490b5533e95e6b74 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 10 Jul 2014 16:43:50 +0200 Subject: [PATCH] [TEST] Wait for longer on slow nodes until replicating has kicked in --- .../org/elasticsearch/index/store/CorruptedFileTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index 4eaf94ac24e..6a82faa3651 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -75,6 +75,7 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; @@ -86,7 +87,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.builder() // we really need local GW here since this also checks for corruption etc. - // and we need to make sure primaries are not just trashed if we dont' have replicase + // and we need to make sure primaries are not just trashed if we don'tmvn have replicas .put(super.nodeSettings(nodeOrdinal)).put("gateway.type", "local") .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()).build(); } @@ -237,17 +238,18 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { client().admin().indices().prepareUpdateSettings("test").setSettings(build).get(); client().admin().cluster().prepareReroute().get(); - awaitBusy(new Predicate() { + boolean didClusterTurnRed = awaitBusy(new Predicate() { @Override public boolean apply(Object input) { ClusterHealthStatus test = client().admin().cluster() .health(Requests.clusterHealthRequest("test")).actionGet().getStatus(); return test == ClusterHealthStatus.RED; } - }); + }, 5, TimeUnit.MINUTES);// sometimes on slow nodes the replication / recovery is just dead slow final ClusterHealthResponse response = client().admin().cluster() .health(Requests.clusterHealthRequest("test")).get(); if (response.getStatus() != ClusterHealthStatus.RED) { + logger.info("Cluster turned red in busy loop: {}", didClusterTurnRed); logger.info("cluster state:\n{}\n{}", client().admin().cluster().prepareState().get().getState().prettyPrint(), client().admin().cluster().preparePendingClusterTasks().get().prettyPrint()); } assertThat(response.getStatus(), is(ClusterHealthStatus.RED));