This is an automated email from the ASF dual-hosted git repository.

jt2594838 pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 44cb7c2f6fb Fix flaky space quota IT (#17812) (#17824)
44cb7c2f6fb is described below

commit 44cb7c2f6fb67095d9a9c1e1d551faa13548f664
Author: Caideyipi <[email protected]>
AuthorDate: Wed Jun 3 15:37:55 2026 +0800

    Fix flaky space quota IT (#17812) (#17824)
    
    (cherry picked from commit 99f0af16c890529320fa5248c15f2da41953ebcb)
---
 .../iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java      | 30 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java
index 7ed80f7ab4a..8930985717f 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.it.framework.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
+import org.awaitility.Awaitility;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -40,6 +41,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -297,8 +299,6 @@ public class IoTDBSpaceQuotaIT {
           "create timeseries root.sg0.wf01.wt02.status0 with 
datatype=BOOLEAN,encoding=PLAIN;");
       adminStmt.execute(
           "create timeseries root.sg0.wf01.wt02.status1 with 
datatype=BOOLEAN,encoding=PLAIN;");
-      Thread.sleep(2000);
-      ResultSet resultSet1 = adminStmt.executeQuery("show space quota 
root.sg0;");
       String ans1 =
           "root.sg0,diskSize,0.09765625G,0.0G"
               + ",\n"
@@ -306,8 +306,8 @@ public class IoTDBSpaceQuotaIT {
               + ",\n"
               + "root.sg0,timeSeriesNum,5,3"
               + ",\n";
-      validateResultSet(resultSet1, ans1);
-    } catch (InterruptedException | SQLException e) {
+      validateResultSetEventually(adminStmt, "show space quota root.sg0;", 
ans1);
+    } catch (SQLException e) {
       Assert.fail(e.getMessage());
     }
   }
@@ -509,6 +509,22 @@ public class IoTDBSpaceQuotaIT {
     }
   }
 
+  private void validateResultSetEventually(Statement statement, String sql, 
String ans) {
+    Awaitility.await()
+        .pollInSameThread()
+        .pollDelay(0, TimeUnit.MILLISECONDS)
+        .pollInterval(1, TimeUnit.SECONDS)
+        .atMost(30, TimeUnit.SECONDS)
+        .untilAsserted(
+            () -> {
+              try {
+                validateResultSet(statement.executeQuery(sql), ans);
+              } catch (SQLException e) {
+                Assert.fail(e.getMessage());
+              }
+            });
+  }
+
   private void validateResultSet(ResultSet set, String ans) throws 
SQLException {
     try {
       StringBuilder builder = new StringBuilder();
@@ -521,12 +537,12 @@ public class IoTDBSpaceQuotaIT {
         builder.append("\n");
       }
       String result = builder.toString();
-      assertEquals(ans.length(), result.length());
+      assertEquals(result, ans.length(), result.length());
       List<String> ansLines = Arrays.asList(ans.split("\n"));
       List<String> resultLines = Arrays.asList(result.split("\n"));
-      assertEquals(ansLines.size(), resultLines.size());
+      assertEquals(result, ansLines.size(), resultLines.size());
       for (String resultLine : resultLines) {
-        assertTrue(ansLines.contains(resultLine));
+        assertTrue(result, ansLines.contains(resultLine));
       }
     } finally {
       set.close();

Reply via email to