Apache9 commented on code in PR #7626:
URL: https://github.com/apache/hbase/pull/7626#discussion_r2701196134


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java:
##########
@@ -341,23 +345,25 @@ public void testTimeout() throws IOException {
         pcrc.reset();
         pcrc.setCallTimeout(timeout);
         long startTime = System.nanoTime();
-        try {
-          stub.pause(pcrc, PauseRequestProto.newBuilder().setMs(ms).build());
-        } catch (ServiceException e) {
-          long waitTime = (System.nanoTime() - startTime) / 1000000;
-          // expected
-          LOG.info("Caught expected exception: " + e);
-          IOException ioe = ProtobufUtil.handleRemoteException(e);
-          assertTrue(ioe.getCause() instanceof CallTimeoutException);
-          // confirm that we got exception before the actual pause.
-          assertTrue(waitTime < ms);
-        }
+        ServiceException se = assertThrows(ServiceException.class,
+          () -> stub.pause(pcrc, 
PauseRequestProto.newBuilder().setMs(ms).build()));
+        long waitTime = (System.nanoTime() - startTime) / 1000000;
+        // expected
+        LOG.info("Caught expected exception: " + se);
+        IOException ioe = ProtobufUtil.handleRemoteException(se);
+        assertThat(ioe.getCause(), instanceOf(CallTimeoutException.class));
+        // confirm that we got exception before the actual pause.
+        assertThat(waitTime, lessThan((long) ms));
       }
     } finally {
+      // wait until all active calls quit, otherwise it may mess up the 
tracing spans
+      await().atMost(Duration.ofSeconds(2))

Review Comment:
   The timeout value is 1 secs, so I think 2 secs is enough?



-- 
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]

Reply via email to