adoroszlai opened a new pull request, #5807:
URL: https://github.com/apache/ozone/pull/5807

   ## What changes were proposed in this pull request?
   
   Let `TimedOutTestsListener` implement JUnit5's `TestExecutionListener` to 
print thread dump in case tests time out.
   
   https://issues.apache.org/jira/browse/HDDS-9938
   
   ## How was this patch tested?
   
   Added a test in 
`hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/TestConfigFileGenerator.java`
 which always times out:
   
   ```java
     @Test
     @Timeout(1)
     void timeoutTest() throws Exception {
       Thread.sleep(2000);
     }
   ```
   
   ran the test:
   
   ```
   mvn -am -pl :hdds-config -Dtest=TestConfigFileGenerator clean test
   ```
   
   and verified the output file created for the test:
   
   ```
   ====> timeoutTest() TIMED OUT. PRINTING THREAD DUMP. <====
   
   Timestamp: 2023-12-16 04:04:27,669
   
   ...
   
   "main"  prio=5 tid=1 runnable
   java.lang.Thread.State: RUNNABLE
     at java.lang.Thread.dumpThreads(Native Method)
     at java.lang.Thread.getAllStackTraces(Thread.java:1615)
     at 
org.apache.ozone.test.TimedOutTestsListener.buildThreadDump(TimedOutTestsListener.java:83)
     at 
org.apache.ozone.test.TimedOutTestsListener.buildThreadDiagnosticString(TimedOutTestsListener.java:69)
     at 
org.apache.ozone.test.TimedOutTestsListener.lambda$executionFinished$0(TimedOutTestsListener.java:55)
     at 
org.apache.ozone.test.TimedOutTestsListener$$Lambda$452/996796369.accept(Unknown
 Source)
     at java.util.Optional.ifPresent(Optional.java:159)
     at 
org.apache.ozone.test.TimedOutTestsListener.executionFinished(TimedOutTestsListener.java:51)
     ...
   ```
   
   CI:
   https://github.com/adoroszlai/ozone/actions/runs/7232674785


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