Browse Source

pending states assertion should dump states

 This was removed in a cleanup assuming that Hamcrest will dump the array content. Sadly it only dumps the size.
Boaz Leskes 9 years ago
parent
commit
be1772b70d

+ 8 - 2
test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

@@ -164,6 +164,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.BooleanSupplier;
 import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static org.elasticsearch.client.Requests.syncedFlushRequest;
 import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
@@ -535,8 +537,12 @@ public abstract class ESIntegTestCase extends ESTestCase {
                         for (Discovery discovery : internalCluster().getInstances(Discovery.class)) {
                             if (discovery instanceof ZenDiscovery) {
                                 final ZenDiscovery zenDiscovery = (ZenDiscovery) discovery;
-                                assertBusy(() -> assertThat(zenDiscovery.localNode().getName() + " still having pending states",
-                                    zenDiscovery.pendingClusterStates(), emptyArray()));
+                                assertBusy(() -> {
+                                    final ClusterState[] states = zenDiscovery.pendingClusterStates();
+                                    assertThat(zenDiscovery.localNode().getName() + " still having pending states:\n" +
+                                            Stream.of(states).map(ClusterState::toString).collect(Collectors.joining("\n")),
+                                        states, emptyArray());
+                                });
                             }
                         }
                     }