GetActionTests: call ensureGreen() to get more meaningful debug output on failure

This commit is contained in:
Britta Weber 2013-09-18 14:29:54 +02:00
parent 995c55b861
commit 04c560ce9f
1 changed files with 5 additions and 13 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.get; package org.elasticsearch.get;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.delete.DeleteResponse; 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.settings.ImmutableSettings;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.AbstractSharedClusterTest;
import org.junit.Test; import org.junit.Test;
import java.util.Map; 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(); client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)).execute().actionGet();
ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); ensureGreen();
assertThat(clusterHealth.isTimedOut(), equalTo(false));
assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN));
MultiGetResponse response = client().prepareMultiGet().add("test", "type1", "1").execute().actionGet(); MultiGetResponse response = client().prepareMultiGet().add("test", "type1", "1").execute().actionGet();
assertThat(response.getResponses().length, equalTo(1)); 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()) .addMapping("type", jsonBuilder().startObject().startObject("type").startObject("_source").field("compress", true).endObject().endObject().endObject())
.execute().actionGet(); .execute().actionGet();
ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); ensureGreen();
assertThat(clusterHealth.isTimedOut(), equalTo(false));
assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < 10000; i++) { for (int i = 0; i < 10000; i++) {
@ -248,9 +244,7 @@ public class GetActionTests extends AbstractSharedClusterTest {
.endObject().endObject()) .endObject().endObject())
.execute().actionGet(); .execute().actionGet();
ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); ensureGreen();
assertThat(clusterHealth.isTimedOut(), equalTo(false));
assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN));
client().prepareIndex("test", "type1", "1").setSource( client().prepareIndex("test", "type1", "1").setSource(
jsonBuilder().startObject() jsonBuilder().startObject()
@ -341,9 +335,7 @@ public class GetActionTests extends AbstractSharedClusterTest {
.setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))
.execute().actionGet(); .execute().actionGet();
ClusterHealthResponse clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); ensureGreen();
assertThat(clusterHealth.isTimedOut(), equalTo(false));
assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN));
GetResponse response = client().prepareGet("test", "type1", "1").execute().actionGet(); GetResponse response = client().prepareGet("test", "type1", "1").execute().actionGet();
assertThat(response.isExists(), equalTo(false)); assertThat(response.isExists(), equalTo(false));