Skip to content

Commit a4b4283

Browse files
committed
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.
1 parent b79a077 commit a4b4283

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexFailureTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ public void testResponseOnSearchFailure() throws Exception {
107107
response.get();
108108
logger.info("Didn't trigger a reindex failure on the {} attempt", attempt);
109109
attempt++;
110+
/*
111+
* In the past we've seen the delete of the source index
112+
* actually take effect *during* the `indexDocs` call in
113+
* the next step. This breaks things pretty disasterously
114+
* so we *try* and wait for the delete to be fully
115+
* complete here.
116+
*/
117+
assertBusy(() -> assertFalse(client().admin().indices().prepareExists("source").get().isExists()));
110118
} catch (ExecutionException e) {
111119
logger.info("Triggered a reindex failure on the {} attempt: {}", attempt, e.getMessage());
112120
assertThat(e.getMessage(),

0 commit comments

Comments
 (0)