Tests: Give stats tests long to wait for listener

This test waited 10 seconds for a refresh listener to appear in
the stats. It turns out that in our NFS testing infrastructure this can
take a lot longer than 10 seconds. The error reported here:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+nfs/257/consoleFull
has it taking something like 15 seconds. This bumps the timeout
to a solid minute.

Closes #24417
This commit is contained in:
Nik Everett 2017-05-09 12:27:53 -04:00
parent b6c714ccc8
commit 428390865c
1 changed files with 4 additions and 3 deletions

View File

@ -118,7 +118,6 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
} }
} }
@TestLogging("_root:debug")
public void testRefreshListeners() throws Exception { public void testRefreshListeners() throws Exception {
// Create an index without automatic refreshes // Create an index without automatic refreshes
createIndex("test", Settings.builder().put("refresh_interval", -1).build()); createIndex("test", Settings.builder().put("refresh_interval", -1).build());
@ -127,8 +126,9 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
ActionFuture<IndexResponse> index = client().prepareIndex("test", "test", "test").setSource("test", "test") ActionFuture<IndexResponse> index = client().prepareIndex("test", "test", "test").setSource("test", "test")
.setRefreshPolicy(RefreshPolicy.WAIT_UNTIL).execute(); .setRefreshPolicy(RefreshPolicy.WAIT_UNTIL).execute();
// Wait for the refresh listener to appear in the stats // Wait for the refresh listener to appear in the stats. Wait a long time because NFS tests can be quite slow!
long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(10); logger.info("starting to wait");
long end = System.nanoTime() + TimeUnit.MINUTES.toNanos(1);
while (true) { while (true) {
IndicesStatsResponse stats = client().admin().indices().prepareStats("test").clear().setRefresh(true).setDocs(true).get(); IndicesStatsResponse stats = client().admin().indices().prepareStats("test").clear().setRefresh(true).setDocs(true).get();
CommonStats common = stats.getIndices().get("test").getTotal(); CommonStats common = stats.getIndices().get("test").getTotal();
@ -138,6 +138,7 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
break; break;
} }
if (end - System.nanoTime() < 0) { if (end - System.nanoTime() < 0) {
logger.info("timed out");
fail("didn't get a refresh listener in time: " + Strings.toString(common)); fail("didn't get a refresh listener in time: " + Strings.toString(common));
} }
} }