From 04c560ce9fa55df240b002383f619505a0724717 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Wed, 18 Sep 2013 14:29:54 +0200 Subject: [PATCH] GetActionTests: call ensureGreen() to get more meaningful debug output on failure --- .../org/elasticsearch/get/GetActionTests.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/elasticsearch/get/GetActionTests.java b/src/test/java/org/elasticsearch/get/GetActionTests.java index c650aa2a85a..b2dc3a010d3 100644 --- a/src/test/java/org/elasticsearch/get/GetActionTests.java +++ b/src/test/java/org/elasticsearch/get/GetActionTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.get; +import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.delete.DeleteResponse; @@ -32,7 +33,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.engine.VersionConflictEngineException; -import org.elasticsearch.AbstractSharedClusterTest; import org.junit.Test; import java.util.Map; @@ -161,9 +161,7 @@ public class GetActionTests extends AbstractSharedClusterTest { } client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)).execute().actionGet(); - ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); - assertThat(clusterHealth.isTimedOut(), equalTo(false)); - assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); + ensureGreen(); MultiGetResponse response = client().prepareMultiGet().add("test", "type1", "1").execute().actionGet(); assertThat(response.getResponses().length, equalTo(1)); @@ -212,9 +210,7 @@ public class GetActionTests extends AbstractSharedClusterTest { .addMapping("type", jsonBuilder().startObject().startObject("type").startObject("_source").field("compress", true).endObject().endObject().endObject()) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); - assertThat(clusterHealth.isTimedOut(), equalTo(false)); - assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); + ensureGreen(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; i++) { @@ -248,9 +244,7 @@ public class GetActionTests extends AbstractSharedClusterTest { .endObject().endObject()) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); - assertThat(clusterHealth.isTimedOut(), equalTo(false)); - assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); + ensureGreen(); client().prepareIndex("test", "type1", "1").setSource( jsonBuilder().startObject() @@ -341,9 +335,7 @@ public class GetActionTests extends AbstractSharedClusterTest { .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); - assertThat(clusterHealth.isTimedOut(), equalTo(false)); - assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); + ensureGreen(); GetResponse response = client().prepareGet("test", "type1", "1").execute().actionGet(); assertThat(response.isExists(), equalTo(false));