This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 6d9f4d6f6 [flink] fix unstable test:
MySqlSyncDatabaseTableListITCase#testActionRunResult (#1752)
6d9f4d6f6 is described below
commit 6d9f4d6f61f29507446a596b1c22e32a6330c357
Author: liming.1018 <[email protected]>
AuthorDate: Tue Aug 8 11:33:54 2023 +0800
[flink] fix unstable test:
MySqlSyncDatabaseTableListITCase#testActionRunResult (#1752)
---
.../mysql/MySqlSyncDatabaseTableListITCase.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncDatabaseTableListITCase.java
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncDatabaseTableListITCase.java
index ed370b5c0..faf9f2977 100644
---
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncDatabaseTableListITCase.java
+++
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncDatabaseTableListITCase.java
@@ -30,6 +30,7 @@ import org.junit.jupiter.api.Timeout;
import java.sql.Statement;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
@@ -47,7 +48,7 @@ public class MySqlSyncDatabaseTableListITCase extends
MySqlActionITCaseBase {
}
@Test
- @Timeout(60)
+ @Timeout(120)
public void testActionRunResult() throws Exception {
Map<String, String> mySqlConfig = getBasicMySqlConfig();
mySqlConfig.put("database-name", ".*shard_.*");
@@ -78,9 +79,9 @@ public class MySqlSyncDatabaseTableListITCase extends
MySqlActionITCaseBase {
waitJobRunning(client);
try (Statement statement = getStatement()) {
- Thread.sleep(5_000);
Catalog catalog = catalog();
- assertThat(catalog.listTables(database))
+ List<String> tables = waitingAllTables(catalog, 10, 10);
+ assertThat(tables)
.containsExactlyInAnyOrder(
"shard_1_t11",
"shard_1_t2",
@@ -126,9 +127,9 @@ public class MySqlSyncDatabaseTableListITCase extends
MySqlActionITCaseBase {
statement.executeUpdate(
"CREATE TABLE s4 (k INT, name VARCHAR(100), PRIMARY
KEY (k))");
- Thread.sleep(5_000);
+ tables = waitingAllTables(catalog, 12, 10);
- assertThat(catalog.listTables(database))
+ assertThat(tables)
.containsExactlyInAnyOrder(
// old
"shard_1_t11",
@@ -147,4 +148,16 @@ public class MySqlSyncDatabaseTableListITCase extends
MySqlActionITCaseBase {
}
}
}
+
+ private List<String> waitingAllTables(Catalog catalog, int numberOfTables,
int maxAttempt)
+ throws Exception {
+ List<String> tables;
+ int attempt = 0;
+ do {
+ Thread.sleep(5_000);
+ tables = catalog.listTables(database);
+ } while (tables.size() < numberOfTables && ++attempt < maxAttempt);
+
+ return tables;
+ }
}