This is an automated email from the ASF dual-hosted git repository. jiangtian pushed a commit to branch improve_ut_stability in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 80611b9bc6595d01bd830355320bfef31ed37c49 Author: Tian Jiang <[email protected]> AuthorDate: Mon Jan 26 11:48:52 2026 +0800 Improve stablity of BinaryAllocatorTest#testEviction --- .../apache/iotdb/commons/binaryallocator/BinaryAllocatorTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/binaryallocator/BinaryAllocatorTest.java b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/binaryallocator/BinaryAllocatorTest.java index 27cb2d37cce..0a39cda4d39 100644 --- a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/binaryallocator/BinaryAllocatorTest.java +++ b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/binaryallocator/BinaryAllocatorTest.java @@ -23,6 +23,7 @@ import org.apache.iotdb.commons.binaryallocator.config.AllocatorConfig; import org.apache.iotdb.commons.binaryallocator.utils.SizeClasses; import org.apache.tsfile.utils.PooledBinary; +import org.awaitility.Awaitility; import org.junit.Test; import java.util.Collections; @@ -102,7 +103,7 @@ public class BinaryAllocatorTest { } @Test - public void testEviction() throws InterruptedException { + public void testEviction() { AllocatorConfig config = new AllocatorConfig(); config.arenaNum = 1; config.minAllocateSize = config.maxAllocateSize = 4096; @@ -112,9 +113,8 @@ public class BinaryAllocatorTest { PooledBinary binary = binaryAllocator.allocateBinary(4096, false); binaryAllocator.deallocateBinary(binary); - assertEquals(binaryAllocator.getTotalUsedMemory(), 4096); - Thread.sleep(200); - assertEquals(binaryAllocator.getTotalUsedMemory(), 0); + assertEquals(4096, binaryAllocator.getTotalUsedMemory()); + Awaitility.await().atMost(20, TimeUnit.SECONDS).until(() -> binaryAllocator.getTotalUsedMemory() == 0); } @Test
