[TEST] Fix ClusterStatsTests#testValuesSmokeScreen to wait for yellow to get reliable FS stats.

This commit is contained in:
Simon Willnauer 2014-04-12 23:02:14 +02:00
parent ec3c635696
commit ad143e16cf
1 changed files with 6 additions and 1 deletions

View File

@ -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