From 4bf685cd31070f8ee4474ce0d064039f1a81e68d Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Fri, 9 Sep 2016 12:05:23 +0200 Subject: [PATCH] [TEST] wait for pending tasks finished before testing cluster state collector Original commit: elastic/x-pack-elasticsearch@d42c8c4bbe4cbab1f9398030e74e0fce59b4a816 --- .../collector/cluster/ClusterStateCollectorTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStateCollectorTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStateCollectorTests.java index 4f8f3922547..2203d88f14c 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStateCollectorTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStateCollectorTests.java @@ -34,6 +34,9 @@ import static org.hamcrest.Matchers.notNullValue; public class ClusterStateCollectorTests extends AbstractCollectorTestCase { public void testClusterStateCollectorNoIndices() throws Exception { + // waits for pending tasks before collecing cluster state. + // prevents the collector to read an older cluster state than the one used in assert later + ensureGreen(); assertMonitoringDocs(newClusterStateCollector().doCollect(), 0); }