This is an automated email from the ASF dual-hosted git repository. Caideyipi pushed a commit to branch cp-18943-dev-1.3 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 0c906ccca1bc798c64f73eadfe2998491b7b7352 Author: Caideyipi <[email protected]> AuthorDate: Wed Oct 21 12:35:58 2026 +0800 [To dev/1.3] [Test] Speed up integration tests --- .../org/apache/iotdb/db/it/utils/TestUtils.java | 10 ++++----- .../pipe/it/autocreate/IoTDBPipeClusterIT.java | 5 ++--- .../session/it/IoTDBSessionSchemaTemplateIT.java | 26 +++++++++++++++++----- .../it/IoTDBSubscriptionITConstant.java | 3 ++- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java index b2a7ba4d22e..ecaa3b94921 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java @@ -842,7 +842,7 @@ public class TestUtils { // Keep retrying if there are execution failures await() .pollInSameThread() - .pollDelay(1L, TimeUnit.SECONDS) + .pollDelay(0L, TimeUnit.SECONDS) .pollInterval(1L, TimeUnit.SECONDS) .atMost(timeoutSeconds, TimeUnit.SECONDS) .untilAsserted( @@ -872,7 +872,7 @@ public class TestUtils { // Keep retrying if there are execution failures await() .pollInSameThread() - .pollDelay(1L, TimeUnit.SECONDS) + .pollDelay(0L, TimeUnit.SECONDS) .pollInterval(1L, TimeUnit.SECONDS) .atMost(timeoutSeconds, TimeUnit.SECONDS) .untilAsserted( @@ -921,7 +921,7 @@ public class TestUtils { // Keep retrying if there are execution failures await() .pollInSameThread() - .pollDelay(1L, TimeUnit.SECONDS) + .pollDelay(0L, TimeUnit.SECONDS) .pollInterval(1L, TimeUnit.SECONDS) .atMost(timeoutSeconds, TimeUnit.SECONDS) .untilAsserted( @@ -952,7 +952,7 @@ public class TestUtils { // Keep retrying if there are execution failures await() .pollInSameThread() - .pollDelay(1L, TimeUnit.SECONDS) + .pollDelay(0L, TimeUnit.SECONDS) .pollInterval(1L, TimeUnit.SECONDS) .atMost(timeoutSeconds, TimeUnit.SECONDS) .untilAsserted( @@ -986,7 +986,7 @@ public class TestUtils { // Keep retrying if there are execution failures await() .pollInSameThread() - .pollDelay(1L, TimeUnit.SECONDS) + .pollDelay(0L, TimeUnit.SECONDS) .pollInterval(1L, TimeUnit.SECONDS) .atMost(consistentSeconds, TimeUnit.SECONDS) .failFast( diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java index 43568e887d9..047ba3c5afb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipeClusterIT.java @@ -164,9 +164,8 @@ public class IoTDBPipeClusterIT extends AbstractPipeDualAutoIT { Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); receiverEnv.getDataNodeWrapper(0).stop(); - - // Ensure that the kill -9 operation is completed - Thread.sleep(5000); + // stop() waits for process exit; verify it succeeded before checking failover. + Assert.assertFalse(receiverEnv.getDataNodeWrapper(0).isAlive()); for (DataNodeWrapper nodeWrapper : receiverEnv.getDataNodeWrapperList()) { if (!nodeWrapper.isAlive()) { continue; diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java index 96836c7d443..457c7114044 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java @@ -41,6 +41,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.junit.runners.Parameterized; import java.io.IOException; import java.util.ArrayList; @@ -63,20 +64,33 @@ public class IoTDBSessionSchemaTemplateIT extends AbstractSchemaIT { super(schemaTestMode); } + // Keep one cluster per schema engine mode, and clear its schema between test methods. + @Parameterized.BeforeParam + public static void before() throws Exception { + setUpEnvironment(); + EnvFactory.getEnv().initClusterEnvironment(); + } + + @Parameterized.AfterParam + public static void after() throws Exception { + EnvFactory.getEnv().cleanClusterEnvironment(); + tearDownEnvironment(); + } + @Before public void setUp() throws Exception { - setUpEnvironmentBeforeMethod(); - EnvFactory.getEnv().initClusterEnvironment(); session = EnvFactory.getEnv().getSessionConnection(); } @After public void tearDown() throws Exception { - if (session != null) { - session.close(); + try { + if (session != null) { + session.close(); + } + } finally { + clearSchema(); } - EnvFactory.getEnv().cleanClusterEnvironment(); - tearDownEnvironment(); } @Test diff --git a/integration-test/src/test/java/org/apache/iotdb/subscription/it/IoTDBSubscriptionITConstant.java b/integration-test/src/test/java/org/apache/iotdb/subscription/it/IoTDBSubscriptionITConstant.java index 3162139fb66..6c7eb061789 100644 --- a/integration-test/src/test/java/org/apache/iotdb/subscription/it/IoTDBSubscriptionITConstant.java +++ b/integration-test/src/test/java/org/apache/iotdb/subscription/it/IoTDBSubscriptionITConstant.java @@ -31,7 +31,8 @@ import java.util.function.Consumer; public class IoTDBSubscriptionITConstant { - private static final long AWAITILITY_POLL_DELAY_SECOND = 1L; + // Conditions may already hold when the assertion starts; only wait between retries. + private static final long AWAITILITY_POLL_DELAY_SECOND = 0L; private static final long AWAITILITY_POLL_INTERVAL_SECOND = 1L; private static final long AWAITILITY_AT_MOST_SECOND = 600L;
