You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by lz...@apache.org on 2022/11/28 06:59:14 UTC
[flink-table-store] branch master updated: [FLINK-29987] Use Awaitility in PartialUpdateITCase#testForeignKeyJoin
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/flink-table-store.git
The following commit(s) were added to refs/heads/master by this push:
new cd0870ba [FLINK-29987] Use Awaitility in PartialUpdateITCase#testForeignKeyJoin
cd0870ba is described below
commit cd0870bab446ad8e91dab3ddd3b3b6e7ef71612f
Author: Alex Sorokoumov <91...@users.noreply.github.com>
AuthorDate: Mon Nov 28 07:59:08 2022 +0100
[FLINK-29987] Use Awaitility in PartialUpdateITCase#testForeignKeyJoin
This closes #404
---
.../table/store/connector/PartialUpdateITCase.java | 24 ++++++++++++++++------
pom.xml | 8 ++++++++
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/PartialUpdateITCase.java b/flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/PartialUpdateITCase.java
index 904fd90e..deb45117 100644
--- a/flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/PartialUpdateITCase.java
+++ b/flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/PartialUpdateITCase.java
@@ -23,11 +23,13 @@ import org.apache.flink.types.Row;
import org.apache.flink.types.RowKind;
import org.apache.flink.util.CloseableIterator;
+import org.awaitility.Awaitility;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
@@ -105,15 +107,25 @@ public class PartialUpdateITCase extends FileStoreTableITCase {
batchSql("INSERT INTO ods_orders VALUES (1, 2, 3)");
batchSql("INSERT INTO dim_persons VALUES (3, 'snow', 'jon', 23)");
- Thread.sleep(1000);
- assertThat(rowsToList(batchSql("SELECT * FROM dwd_orders")))
- .containsExactly(Arrays.asList(1, 2, 3, "snow", "jon", 23));
+ Awaitility.await()
+ .pollInSameThread()
+ .atMost(5, TimeUnit.SECONDS)
+ .untilAsserted(
+ () ->
+ assertThat(rowsToList(batchSql("SELECT * FROM dwd_orders")))
+ .containsExactly(
+ Arrays.asList(1, 2, 3, "snow", "jon", 23)));
batchSql("INSERT INTO ods_orders VALUES (1, 4, 3)");
batchSql("INSERT INTO dim_persons VALUES (3, 'snow', 'targaryen', 23)");
- Thread.sleep(1000);
- assertThat(rowsToList(batchSql("SELECT * FROM dwd_orders")))
- .containsExactly(Arrays.asList(1, 4, 3, "snow", "targaryen", 23));
+ Awaitility.await()
+ .pollInSameThread()
+ .atMost(5, TimeUnit.SECONDS)
+ .untilAsserted(
+ () ->
+ assertThat(rowsToList(batchSql("SELECT * FROM dwd_orders")))
+ .containsExactly(
+ Arrays.asList(1, 4, 3, "snow", "targaryen", 23)));
iter.close();
}
diff --git a/pom.xml b/pom.xml
index 46078c86..b04f1dfc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,7 @@ under the License.
<flink.forkCount>1C</flink.forkCount>
<flink.reuseForks>true</flink.reuseForks>
<testcontainers.version>1.17.2</testcontainers.version>
+ <awaitility.version>4.2.0</awaitility.version>
<!-- Can be set to any value to reproduce a specific build. -->
<test.randomization.seed/>
@@ -183,6 +184,13 @@ under the License.
<artifactId>log4j-1.2-api</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <version>${awaitility.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>