This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new b7c12a20116 Improve stability of BinaryAllocatorTest#testEviction
(#17078)
b7c12a20116 is described below
commit b7c12a2011643d30fca8624e0e63595404ef8570
Author: Jiang Tian <[email protected]>
AuthorDate: Mon Jan 26 14:07:05 2026 +0800
Improve stability of BinaryAllocatorTest#testEviction (#17078)
* Improve stablity of BinaryAllocatorTest#testEviction
* spotless
---
.../iotdb/commons/binaryallocator/BinaryAllocatorTest.java | 10 ++++++----
1 file changed, 6 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..df11f871118 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,10 @@ 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