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

aljoscha pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git

commit cc59b3a7c4853be80a9d2868ed9e7d6c09966edc
Author: Aljoscha Krettek <[email protected]>
AuthorDate: Thu Jun 4 15:21:06 2020 +0200

    [FLINK-18020] Increase timeout in SQLClientKafkaITCase
---
 .../apache/flink/tests/util/kafka/SQLClientKafkaITCase.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/test/java/org/apache/flink/tests/util/kafka/SQLClientKafkaITCase.java
 
b/flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/test/java/org/apache/flink/tests/util/kafka/SQLClientKafkaITCase.java
index fabefc1..f087e31 100644
--- 
a/flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/test/java/org/apache/flink/tests/util/kafka/SQLClientKafkaITCase.java
+++ 
b/flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/test/java/org/apache/flink/tests/util/kafka/SQLClientKafkaITCase.java
@@ -18,6 +18,7 @@
 
 package org.apache.flink.tests.util.kafka;
 
+import org.apache.flink.api.common.time.Deadline;
 import org.apache.flink.tests.util.TestUtils;
 import org.apache.flink.tests.util.cache.DownloadCache;
 import org.apache.flink.tests.util.categories.TravisGroup1;
@@ -52,6 +53,7 @@ import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -234,8 +236,8 @@ public class SQLClientKafkaITCase extends TestLogger {
 
        private void checkCsvResultFile() throws Exception {
                boolean success = false;
-               long maxRetries = 10, duration = 5000L;
-               for (int i = 0; i < maxRetries; i++) {
+               final Deadline deadline = 
Deadline.fromNow(Duration.ofSeconds(120));
+               while (!success && deadline.hasTimeLeft()) {
                        if (Files.exists(result)) {
                                byte[] bytes = Files.readAllBytes(result);
                                String[] lines = new String(bytes, 
Charsets.UTF_8).split("\n");
@@ -255,8 +257,8 @@ public class SQLClientKafkaITCase extends TestLogger {
                        } else {
                                LOG.info("The target CSV {} does not exist 
now", result);
                        }
-                       Thread.sleep(duration);
+                       Thread.sleep(500);
                }
-               Assert.assertTrue("Timeout(" + (maxRetries * duration) + " sec) 
to read the correct CSV results.", success);
+               Assert.assertTrue("Did not get expected results before 
timeout.", success);
        }
 }

Reply via email to