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;
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));