From 9b75d3ef98983308308f15aec5cbde3eb1b4bd10 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Wed, 11 Feb 2015 19:00:35 -0500 Subject: [PATCH] Test: wait for the cluster to recover in ClusterServiceTests before waiting for update state task results On CI machines node recovery sometimes takes up to 2 seconds. When it happens an update cluster state task gets stuck behind the recovery and tests fail with 1 second timeout. This commit makes sure that we wait for recovery to complete before starting the clock. --- .../java/org/elasticsearch/cluster/ClusterServiceTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java index ab069d88f35..8c18233fd01 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java @@ -176,6 +176,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { } }); + ensureGreen(); assertThat(latch.await(1, TimeUnit.SECONDS), equalTo(true)); assertThat(allNodesAcked.get(), equalTo(true)); @@ -247,6 +248,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { } }); + ensureGreen(); assertThat(latch.await(1, TimeUnit.SECONDS), equalTo(true)); assertThat(allNodesAcked.get(), equalTo(true)); @@ -373,6 +375,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { } }); + ensureGreen(); assertThat(latch.await(1, TimeUnit.SECONDS), equalTo(true)); assertThat(allNodesAcked.get(), equalTo(true)); @@ -447,6 +450,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { } }); + ensureGreen(); assertThat(latch.await(1, TimeUnit.SECONDS), equalTo(true)); assertThat(allNodesAcked.get(), equalTo(false));