cryptoe commented on code in PR #15176:
URL: https://github.com/apache/druid/pull/15176#discussion_r1369808360


##########
server/src/test/java/org/apache/druid/client/JsonParserIteratorTest.java:
##########
@@ -316,8 +316,41 @@ private Query<?> mockQuery(String queryId, long timeoutAt)
     }
   }
 
+  public static class IAEExceptionConversionTest
+  {
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    private String meshErrMsg = "pstream connect error or disconnect/reset 
before header";
+
+    @Test
+    public void testMeshProxyError()

Review Comment:
   ```suggestion
       public void testParsingError()
   ```



##########
server/src/test/java/org/apache/druid/client/JsonParserIteratorTest.java:
##########
@@ -316,8 +316,41 @@ private Query<?> mockQuery(String queryId, long timeoutAt)
     }
   }
 
+  public static class IAEExceptionConversionTest
+  {
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    private String meshErrMsg = "pstream connect error or disconnect/reset 
before header";

Review Comment:
   Also, can we add a test case with null value. 
   ```suggestion
       private String errorMessage = "pstream connect error or disconnect/reset 
before header";
   ```



##########
server/src/test/java/org/apache/druid/client/JsonParserIteratorTest.java:
##########
@@ -316,8 +316,41 @@ private Query<?> mockQuery(String queryId, long timeoutAt)
     }
   }
 
+  public static class IAEExceptionConversionTest
+  {
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    private String meshErrMsg = "pstream connect error or disconnect/reset 
before header";
+
+    @Test
+    public void testMeshProxyError()
+        throws JsonProcessingException
+    {
+      JsonParserIterator<Object> iterator = new JsonParserIterator<>(
+          JAVA_TYPE,
+          Futures.immediateFuture(
+              mockMeshProxyResponse(meshErrMsg)
+          ),
+          URL,
+          null,
+          HOST,
+          OBJECT_MAPPER
+      );
+
+      expectedException.expect(QueryInterruptedException.class);
+      expectedException.expectMessage(meshErrMsg);
+      iterator.hasNext();
+    }
+  }
+
   private static InputStream mockErrorResponse(Exception e) throws 
JsonProcessingException
   {
     return new ByteArrayInputStream(OBJECT_MAPPER.writeValueAsBytes(e));
   }
+
+  private static InputStream mockMeshProxyResponse(String errMsg) throws 
JsonProcessingException

Review Comment:
   ```suggestion
     private static InputStream mockErrorResponse(String errMsg) throws 
JsonProcessingException
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to