You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "arvi-refacto (via GitHub)" <gi...@apache.org> on 2026/01/21 15:06:32 UTC

[PR] Improve find-unfinished-test.py with bug fixes and new features [kafka]

arvi-refacto opened a new pull request, #21341:
URL: https://github.com/apache/kafka/pull/21341

   ## Summary
   This PR improves the `find-unfinished-test.py` script with critical bug fixes and useful new features for analyzing hanging tests in Gradle logs.
   
   ## Bug Fixes
   - **Fix crash when no test lines found**: Added null check for `last_test_line` to prevent crash when log file contains no test output
   - **Fix KeyError on test completion**: Changed `started.pop(test)` to `started.pop(test, None)` to handle tests that finish without being in STARTED state
   - **Robust error handling**: Added comprehensive error handling for malformed log lines with graceful degradation
   
   ## New Features
   - **`--min-duration` option**: Filter unfinished tests by minimum runtime (in seconds) to focus on long-running tests
   - **`--summary` flag**: Display statistics including total tests processed, average/min/max durations, and malformed line count
   - **Sorted output**: Tests are now sorted by duration (longest first) for easier identification of problematic tests
   - **Enhanced output**: Improved formatting with timestamps, duration in both human-readable and seconds format
   
   ## Code Improvements
   - Extracted `parse_test_line()` and `parse_timestamp()` helper functions for better code organization
   - Added type hints throughout the codebase
   - Added comprehensive docstrings
   - Added usage examples in help text
   - Track and report malformed lines count for better diagnostics
   
   ## Testing
   - Verified script compiles without errors
   - Tested with edge cases (empty files, malformed lines)
   - All existing functionality preserved
   
   ## Impact
   - **Lines changed**: 144 insertions, 26 deletions (net +118 lines)
   - **Backward compatible**: Yes, all existing functionality preserved
   - **Breaking changes**: None


-- 
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-unsubscribe@kafka.apache.org

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


Re: [PR] Improve find-unfinished-test.py with bug fixes and new features [kafka]

Posted by "arvi-refacto (via GitHub)" <gi...@apache.org>.
arvi-refacto closed pull request #21341: Improve find-unfinished-test.py with bug fixes and new features
URL: https://github.com/apache/kafka/pull/21341


-- 
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-unsubscribe@kafka.apache.org

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