narendly commented on a change in pull request #367: Add transient cache for 
CustomRestClient implementation
URL: https://github.com/apache/helix/pull/367#discussion_r309470235
 
 

 ##########
 File path: 
helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java
 ##########
 @@ -145,13 +146,49 @@ public void testPostRequestFormat() throws IOException {
     Assert.assertEquals(json.get("data").asText(), "{}");
   }
 
+  @Test
+  public void testGetPartitionsStoppableCheckWhenMultiThreads()
+      throws IOException, InterruptedException {
+    int parallelCount = 3;
+    MockCustomRestClient customRestClient = new 
MockCustomRestClient(_httpClient, parallelCount);
+    HttpResponse httpResponse = mock(HttpResponse.class);
+    StatusLine statusLine = mock(StatusLine.class);
+
+    when(statusLine.getStatusCode()).thenReturn(HttpStatus.SC_NOT_FOUND);
+    when(httpResponse.getStatusLine()).thenReturn(statusLine);
+    when(_httpClient.execute(any(HttpPost.class))).thenReturn(httpResponse);
+
+    Runnable runnable = () -> {
+      try {
+        LOG.info("Executing {}", Thread.currentThread().getName());
+        customRestClient.getPartitionStoppableCheck(HTTP_LOCALHOST, 
Collections.emptyList(), Collections.emptyMap());
+      } catch (IOException e) {
+        LOG.info("Ignore the exception in test");
 
 Review comment:
   Is logging really necessary for tests? Make it an in-line comment instead?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to