Change ClusterState and PendingClusterTasksResponse's toString() to their prettyPrint format (elastic/elasticsearch#3947)

Change ClusterState and PendingClusterTasksResponse's toString() to their prettyPrint format

Original commit: elastic/x-pack-elasticsearch@4ea9d56058
This commit is contained in:
Boaz Leskes 2016-11-02 13:44:09 +01:00 committed by GitHub
parent fe93640e43
commit 176829c4cc
2 changed files with 15 additions and 15 deletions

View File

@ -207,8 +207,8 @@ public abstract class TribeTransportTestCase extends ESIntegTestCase {
.waitForEvents(Priority.LANGUID).waitForNoRelocatingShards(true)).actionGet(); .waitForEvents(Priority.LANGUID).waitForNoRelocatingShards(true)).actionGet();
if (actionGet.isTimedOut()) { if (actionGet.isTimedOut()) {
logger.info("ensureGreen timed out, cluster state:\n{}\n{}", testCluster.client().admin().cluster() logger.info("ensureGreen timed out, cluster state:\n{}\n{}", testCluster.client().admin().cluster()
.prepareState().get().getState().prettyPrint(), .prepareState().get().getState(),
testCluster.client().admin().cluster().preparePendingClusterTasks().get().prettyPrint()); testCluster.client().admin().cluster().preparePendingClusterTasks().get());
assertThat("timed out waiting for yellow state", actionGet.isTimedOut(), equalTo(false)); assertThat("timed out waiting for yellow state", actionGet.isTimedOut(), equalTo(false));
} }
assertThat(actionGet.getStatus(), anyOf(equalTo(ClusterHealthStatus.YELLOW), equalTo(ClusterHealthStatus.GREEN))); assertThat(actionGet.getStatus(), anyOf(equalTo(ClusterHealthStatus.YELLOW), equalTo(ClusterHealthStatus.GREEN)));

View File

@ -5,17 +5,6 @@
*/ */
package org.elasticsearch.xpack.security.audit.index; package org.elasticsearch.xpack.security.audit.index;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import org.apache.lucene.util.SetOnce; import org.apache.lucene.util.SetOnce;
import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@ -62,6 +51,17 @@ import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
import static org.elasticsearch.test.InternalTestCluster.clusterName; import static org.elasticsearch.test.InternalTestCluster.clusterName;
import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.DAILY; import static org.elasticsearch.xpack.security.audit.index.IndexNameResolver.Rollover.DAILY;
@ -801,8 +801,8 @@ public class IndexAuditTrailTests extends SecurityIntegTestCase {
.waitForNoRelocatingShards(true).waitForYellowStatus().waitForEvents(Priority.LANGUID)).actionGet(); .waitForNoRelocatingShards(true).waitForYellowStatus().waitForEvents(Priority.LANGUID)).actionGet();
if (actionGet.isTimedOut()) { if (actionGet.isTimedOut()) {
logger.info("ensureYellow timed out, cluster state:\n{}\n{}", logger.info("ensureYellow timed out, cluster state:\n{}\n{}",
getClient().admin().cluster().prepareState().get().getState().prettyPrint(), getClient().admin().cluster().prepareState().get().getState(),
getClient().admin().cluster().preparePendingClusterTasks().get().prettyPrint()); getClient().admin().cluster().preparePendingClusterTasks().get());
assertThat("timed out waiting for yellow", actionGet.isTimedOut(), equalTo(false)); assertThat("timed out waiting for yellow", actionGet.isTimedOut(), equalTo(false));
} }