From ad143e16cf0c240b78065d6b3c6376b1c0043754 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 12 Apr 2014 23:02:14 +0200 Subject: [PATCH] [TEST] Fix ClusterStatsTests#testValuesSmokeScreen to wait for yellow to get reliable FS stats. --- .../action/admin/cluster/stats/ClusterStatsTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java index c2eb77e37da..f10aa46a180 100644 --- a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java +++ b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java @@ -130,7 +130,12 @@ public class ClusterStatsTests extends ElasticsearchIntegrationTest { cluster().ensureAtLeastNumNodes(1); SigarService sigarService = cluster().getInstance(SigarService.class); index("test1", "type", "1", "f", "f"); - + /* + * Ensure at least one shard is allocated otherwise the FS stats might + * return 0. This happens if the File#getTotalSpace() and friends is called + * on a directory that doesn't exist or has not yet been created. + */ + ensureYellow("test1"); ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get(); String msg = response.toString(); assertThat(msg, response.getTimestamp(), Matchers.greaterThan(946681200000l)); // 1 Jan 2000