dengziming commented on code in PR #12165:
URL: https://github.com/apache/kafka/pull/12165#discussion_r873557577


##########
core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala:
##########
@@ -195,8 +195,9 @@ class ServerShutdownTest extends KafkaServerTestHarness {
       // identify the correct exception, making sure the server was shutdown, 
and cleaning up if anything
       // goes wrong so that awaitShutdown doesn't hang
       case e: Exception =>
-        assertTrue(exceptionClassTag.runtimeClass.isInstance(e), s"Unexpected 
exception $e")
-        assertEquals(if (quorum == "zk") BrokerState.NOT_RUNNING else 
BrokerState.SHUTTING_DOWN, brokers.head.brokerState)
+        assertTrue(exceptionClassTag.runtimeClass.isInstance(if (isKRaftTest() 
&& e.isInstanceOf[RuntimeException]) e.getCause.getCause else e),

Review Comment:
   Basically, we can change it to something like :
   ```
   throw
   if (e.isInstanceOf[ExecutionException]) 
       e.getCause
    else if (e.isInstanceOf[RuntimeException])
       e.getCause.getCause
   ```
   this would make the logic a little messy, and I'm not sure should we should 
keep the original `RuntimeException` created by @cmccabe.
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to