|
7 | 7 |
|
8 | 8 | import org.apache.http.entity.ContentType;
|
9 | 9 | import org.apache.http.entity.StringEntity;
|
| 10 | +import org.apache.http.util.EntityUtils; |
10 | 11 | import org.apache.logging.log4j.LogManager;
|
11 | 12 | import org.apache.logging.log4j.Logger;
|
12 |
| -import org.apache.lucene.util.LuceneTestCase; |
13 | 13 | import org.elasticsearch.client.Request;
|
14 | 14 | import org.elasticsearch.client.Response;
|
15 | 15 | import org.elasticsearch.client.ResponseException;
|
@@ -109,7 +109,6 @@ public void testBasicCCRAndILMIntegration() throws Exception {
|
109 | 109 | }
|
110 | 110 | }
|
111 | 111 |
|
112 |
| - @LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/48461") |
113 | 112 | public void testCCRUnfollowDuringSnapshot() throws Exception {
|
114 | 113 | String indexName = "unfollow-test-index";
|
115 | 114 | if ("leader".equals(targetCluster)) {
|
@@ -750,10 +749,27 @@ private static Object getIndexSetting(RestClient client, String index, String se
|
750 | 749 | return settings.get(setting);
|
751 | 750 | }
|
752 | 751 |
|
753 |
| - private static void assertDocumentExists(RestClient client, String index, String id) throws IOException { |
754 |
| - Request request = new Request("HEAD", "/" + index + "/_doc/" + id); |
755 |
| - Response response = client.performRequest(request); |
756 |
| - assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); |
| 752 | + private void assertDocumentExists(RestClient client, String index, String id) throws IOException { |
| 753 | + Request request = new Request("GET", "/" + index + "/_doc/" + id); |
| 754 | + Response response; |
| 755 | + try { |
| 756 | + response = client.performRequest(request); |
| 757 | + if (response.getStatusLine().getStatusCode() != 200) { |
| 758 | + if (response.getEntity() != null) { |
| 759 | + logger.error(EntityUtils.toString(response.getEntity())); |
| 760 | + } else { |
| 761 | + logger.error("response body was null"); |
| 762 | + } |
| 763 | + fail("HTTP response code expected to be [200] but was [" + response.getStatusLine().getStatusCode() + "]"); |
| 764 | + } |
| 765 | + } catch (ResponseException ex) { |
| 766 | + if (ex.getResponse().getEntity() != null) { |
| 767 | + logger.error(EntityUtils.toString(ex.getResponse().getEntity()), ex); |
| 768 | + } else { |
| 769 | + logger.error("response body was null"); |
| 770 | + } |
| 771 | + fail("HTTP response code expected to be [200] but was [" + ex.getResponse().getStatusLine().getStatusCode() + "]"); |
| 772 | + } |
757 | 773 | }
|
758 | 774 |
|
759 | 775 | private void createNewSingletonPolicy(String policyName, String phaseName, LifecycleAction action, TimeValue after) throws IOException {
|
|
0 commit comments