This is an automated email from the ASF dual-hosted git repository.
rong 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 edf87ff4fc2 Load IT: Stabilized the
testLoadAutoCreateWithoutInsertPermission test (#15408)
edf87ff4fc2 is described below
commit edf87ff4fc293c34dbcfbfdfab67269b6b98ca6b
Author: Caideyipi <[email protected]>
AuthorDate: Fri Apr 25 10:32:20 2025 +0800
Load IT: Stabilized the testLoadAutoCreateWithoutInsertPermission test
(#15408)
---
.../org/apache/iotdb/db/it/utils/TestUtils.java | 21 ++++++++++++++++
.../manual/basic/IoTDBPipeWithLoadIT.java | 28 ++--------------------
2 files changed, 23 insertions(+), 26 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 2a64278b1e8..ec98e4dcb98 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
@@ -1440,6 +1440,27 @@ public class TestUtils {
}
}
+ // Note that this class will accept any exceptions
+ public static void assertAlwaysFail(final BaseEnv env, final String sql) {
+ assertAlwaysFail(env, sql, 10);
+ }
+
+ public static void assertAlwaysFail(
+ final BaseEnv env, final String sql, final long consistentSeconds) {
+ try (final Connection connection =
env.getConnection(BaseEnv.TABLE_SQL_DIALECT);
+ final Statement statement = connection.createStatement()) {
+ // Keep retrying if there are execution failures
+ await()
+ .pollInSameThread()
+ .pollDelay(1L, TimeUnit.SECONDS)
+ .pollInterval(1L, TimeUnit.SECONDS)
+ .atMost(consistentSeconds, TimeUnit.SECONDS)
+ .failFast(() -> Assert.assertThrows(Exception.class, () ->
statement.executeQuery(sql)));
+ } catch (final Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
public static void assertDataEventuallyOnEnv(
final BaseEnv env,
final DataNodeWrapper dataNodeWrapper,
diff --git
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeWithLoadIT.java
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeWithLoadIT.java
index 1ed3b872024..bc4e7f02053 100644
---
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeWithLoadIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeWithLoadIT.java
@@ -41,7 +41,6 @@ import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import java.sql.Connection;
-import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
@@ -387,11 +386,6 @@ public class IoTDBPipeWithLoadIT extends
AbstractPipeTableModelDualManualIT {
final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
final String receiverIp = receiverDataNode.getIp();
final int receiverPort = receiverDataNode.getPort();
- final Consumer<String> handleFailure =
- o -> {
- TestUtils.executeNonQueryWithRetry(senderEnv, "flush");
- TestUtils.executeNonQueryWithRetry(receiverEnv, "flush");
- };
final Map<String, String> extractorAttributes = new HashMap<>();
final Map<String, String> processorAttributes = new HashMap<>();
@@ -432,27 +426,15 @@ public class IoTDBPipeWithLoadIT extends
AbstractPipeTableModelDualManualIT {
// Ensure the deleted table won't be created
// Now the database will also be created at receiver
- try (final Connection connection =
receiverEnv.getConnection(BaseEnv.TABLE_SQL_DIALECT);
- final Statement statement = connection.createStatement()) {
- statement.executeQuery("describe db.t1");
- fail();
- } catch (final SQLException ignore) {
- // Expected
- }
+ TestUtils.assertAlwaysFail(receiverEnv, "describe db.t1");
}
}
@Test
- @Ignore
public void testLoadAutoCreateWithoutInsertPermission() throws Exception {
final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
final String receiverIp = receiverDataNode.getIp();
final int receiverPort = receiverDataNode.getPort();
- final Consumer<String> handleFailure =
- o -> {
- TestUtils.executeNonQueryWithRetry(senderEnv, "flush");
- TestUtils.executeNonQueryWithRetry(receiverEnv, "flush");
- };
final Map<String, String> extractorAttributes = new HashMap<>();
final Map<String, String> processorAttributes = new HashMap<>();
@@ -502,13 +484,7 @@ public class IoTDBPipeWithLoadIT extends
AbstractPipeTableModelDualManualIT {
// Ensure the table without insert privilege won't be created
// Now the database will also be created at receiver
- try (final Connection connection =
receiverEnv.getConnection(BaseEnv.TABLE_SQL_DIALECT);
- final Statement statement = connection.createStatement()) {
- statement.executeQuery("describe db.t1");
- fail();
- } catch (final SQLException ignore) {
- // Expected
- }
+ TestUtils.assertAlwaysFail(receiverEnv, "describe db.t1");
}
}
}