JackieTien97 opened a new pull request, #17720: URL: https://github.com/apache/iotdb/pull/17720
This pull request improves the reliability and robustness of the `FragmentInstanceExecutionTest` class by ensuring proper initialization, resource management, and output validation. The main changes focus on preventing test flakiness due to uninitialized configuration, improving executor shutdown procedures, and making output assertions more robust. Additionally, a minor fix is included in another test to handle empty or null results. **Test initialization and resource management improvements:** * Added a `@BeforeClass` method to initialize the `DataNodeId` before any tests run, preventing `ExceptionInInitializerError` when static initializers are triggered indirectly. * Replaced direct calls to `ExecutorService.shutdown()` with a new `shutdownAndAwaitTermination` helper method to ensure proper and timely shutdown of thread pools, reducing the risk of resource leaks and test flakiness. [[1]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L113-L128) [[2]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L161-R200) [[3]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L237-R255) * Updated tests to create and terminate executors in a way that avoids capturing unrelated log output and ensures captured output only includes relevant test logs. [[1]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L113-L128) [[2]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L161-R200) **Test output validation and assertions:** * Improved log output assertions in `testTVListOwnerTransfer` to explicitly check that no memory-block release warnings are present, providing clearer failure messages and more robust validation. **General test robustness:** * Updated the `testFragmentInstanceExecution` and `testTVListCloneForQuery` methods to declare `throws InterruptedException`, reflecting possible exceptions from improved executor shutdown logic. [[1]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39R77-R86) [[2]](diffhunk://#diff-dcfd55671e7d63069df535745de113e3d07c999fa04a274e81106661ac788e39L161-R200) * Minor fix in `SingleDeviceViewOperatorTest` to skip null or empty `TsBlock` results, making the test more robust against unexpected operator output. -- 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]
