Skip to content

Commit

Permalink
Reindex: Wait for deletion in test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nik9000 committed Jan 23, 2018
1 parent 049f297 commit eded5bc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ public void testResponseOnSearchFailure() throws Exception {
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(),
Expand Down

0 comments on commit eded5bc

Please sign in to comment.