Jackie-Jiang opened a new pull request, #16628:
URL: https://github.com/apache/pinot/pull/16628

   ## Problem
   
   The `OfflineClusterMemBasedServerQueryKillingTest` had multiple issues:
   1. **Code duplication**: Multiple similar test methods testing OOM scenarios 
with redundant code
   2. **Fragile assertions**: Tests were checking string contents in exception 
messages which is brittle
   3. **Inconsistent error handling**: Different test methods had slightly 
different assertion logic
   4. **Unused imports**: Contained unused import for `IntStream`
   
   ## Solution
   
   This PR refactors the test class to make it more maintainable and robust:
   
   ### 1. Consolidated Test Methods
   - **Before**: 10 separate test methods (`testDigestOOM`, `testDigestOOMMSE`, 
`testSelectionOnlyOOM`, etc.)
   - **After**: 2 parameterized test methods using `@DataProvider` to test all 
OOM query scenarios
   
   ### 2. More Robust Assertions
   - **Before**: String-based assertions checking exception message contents
   - **After**: Structured JSON parsing with proper null checks and error code 
validation
   - Added `assertNotNull` checks for exception nodes
   - Proper error code extraction and validation
   
   ### 3. Better Error Handling for MSE
   - Added comprehensive comment explaining different error codes that can 
occur in multi-stage engine
   - Made assertions more flexible to handle both `QUERY_CANCELLATION` and 
`INTERNAL` error codes
   - Added TODO note about standardizing error codes for OOM cancellations
   
   ### 4. Code Cleanup
   - Removed unused `IntStream` import
   - Removed unused `randomInt` variable
   - Consolidated data provider for all OOM test queries
   
   ## Benefits
   
   1. **Reduced maintenance burden**: From 10 test methods to 2 parameterized 
methods
   2. **More reliable tests**: Proper JSON parsing instead of string matching
   3. **Better error visibility**: Clear error messages when assertions fail
   4. **Consistent behavior**: All OOM scenarios tested with the same logic
   
   ## Files Changed
   
   - `OfflineClusterMemBasedServerQueryKillingTest.java`: Refactored test 
methods and improved assertions
   
   ## Testing
   
   All existing OOM query scenarios are still tested, but now with more robust 
and maintainable code.


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