소스 검색

Tests: Fix RemoteScrollableHitSourceTests

 With  #23307, the expected exception is wrapped two times into a RuntimeException instead of being thrown directly.
Tanguy Leroux 8 년 전
부모
커밋
33eb6a13bf
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      modules/reindex/src/test/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSourceTests.java

+ 5 - 3
modules/reindex/src/test/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSourceTests.java

@@ -462,18 +462,20 @@ public class RemoteScrollableHitSourceTests extends ESTestCase {
     public void testNoContentTypeIsError() throws Exception {
         Exception e = expectThrows(RuntimeException.class, () ->
                 sourceWithMockedRemoteCall(false, null, "main/0_20_5.json").lookupRemoteVersion(null));
-        assertThat(e.getCause().getCause().getMessage(), containsString("Response didn't include Content-Type: body={"));
+        assertThat(e.getCause().getCause().getCause().getMessage(), containsString("Response didn't include Content-Type: body={"));
     }
 
     public void testInvalidJsonThinksRemoveIsNotES() throws IOException {
         Exception e = expectThrows(RuntimeException.class, () -> sourceWithMockedRemoteCall("some_text.txt").doStart(null));
-        assertEquals("Error parsing the response, remote is likely not an Elasticsearch instance", e.getCause().getCause().getMessage());
+        assertEquals("Error parsing the response, remote is likely not an Elasticsearch instance",
+                e.getCause().getCause().getCause().getMessage());
     }
 
     public void testUnexpectedJsonThinksRemoveIsNotES() throws IOException {
         // Use the response from a main action instead of a proper start response to generate a parse error
         Exception e = expectThrows(RuntimeException.class, () -> sourceWithMockedRemoteCall("main/2_3_3.json").doStart(null));
-        assertEquals("Error parsing the response, remote is likely not an Elasticsearch instance", e.getCause().getCause().getMessage());
+        assertEquals("Error parsing the response, remote is likely not an Elasticsearch instance",
+                e.getCause().getCause().getCause().getMessage());
     }
 
     private RemoteScrollableHitSource sourceWithMockedRemoteCall(String... paths) throws Exception {