Reindex: Wait for deletion in test

The test failure tracked by #28053 occurs because we fail to get the
failure response from the reindex on the first try and on our second try
the delete index API call that was supposed to trigger the failure
actually deletes the index during document creation. This causes the
test to fail catastrophically.

This PR attempts to wait for the failure to finish before the test moves
on to the second attempt. The failure doesn't reproduce locally for me
so I can't be sure that this helps at all with the failure, but it
certainly feels like it should help some. Here is hoping this prevents
similar failures in the future.
This commit is contained in:
Nik Everett 2018-01-23 13:35:23 -05:00
parent 049f29710e
commit eded5bc4f3
1 changed files with 8 additions and 0 deletions

View File

@ -107,6 +107,14 @@ public class ReindexFailureTests extends ReindexTestCase {
response.get();
logger.info("Didn't trigger a reindex failure on the {} attempt", attempt);
attempt++;
/*
* In the past we've seen the delete of the source index
* actually take effect *during* the `indexDocs` call in
* the next step. This breaks things pretty disasterously
* so we *try* and wait for the delete to be fully
* complete here.
*/
assertBusy(() -> assertFalse(client().admin().indices().prepareExists("source").get().isExists()));
} catch (ExecutionException e) {
logger.info("Triggered a reindex failure on the {} attempt: {}", attempt, e.getMessage());
assertThat(e.getMessage(),