|
26 | 26 | import org.elasticsearch.Version;
|
27 | 27 | import org.elasticsearch.client.Request;
|
28 | 28 | import org.elasticsearch.client.Response;
|
| 29 | +import org.elasticsearch.client.ResponseException; |
29 | 30 | import org.elasticsearch.cluster.metadata.IndexMetaData;
|
30 | 31 | import org.elasticsearch.common.Booleans;
|
31 | 32 | import org.elasticsearch.common.CheckedFunction;
|
@@ -720,11 +721,14 @@ public void testRecovery() throws Exception {
|
720 | 721 | // We have to spin synced-flush requests here because we fire the global checkpoint sync for the last write operation.
|
721 | 722 | // A synced-flush request considers the global checkpoint sync as an going operation because it acquires a shard permit.
|
722 | 723 | assertBusy(() -> {
|
723 |
| - Response resp = client().performRequest(new Request("POST", index + "/_flush/synced")); |
724 |
| - assertOK(resp); |
725 |
| - Map<String, Object> result = ObjectPath.createFromResponse(resp).evaluate("_shards"); |
726 |
| - assertThat(result.get("successful"), equalTo(result.get("total"))); |
727 |
| - assertThat(result.get("failed"), equalTo(0)); |
| 724 | + try { |
| 725 | + Response resp = client().performRequest(new Request("POST", index + "/_flush/synced")); |
| 726 | + Map<String, Object> result = ObjectPath.createFromResponse(resp).evaluate("_shards"); |
| 727 | + assertThat(result.get("successful"), equalTo(result.get("total"))); |
| 728 | + assertThat(result.get("failed"), equalTo(0)); |
| 729 | + } catch (ResponseException ex) { |
| 730 | + throw new AssertionError(ex); // cause assert busy to retry |
| 731 | + } |
728 | 732 | });
|
729 | 733 | } else {
|
730 | 734 | // Explicitly flush so we're sure to have a bunch of documents in the Lucene index
|
|
0 commit comments