Skip to content

Commit

Permalink
[FLINK-18020] Increase timeout in SQLClientKafkaITCase
Browse files Browse the repository at this point in the history
  • Loading branch information
aljoscha committed Jun 5, 2020
1 parent f6bbff4 commit 971e7b2
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,6 +53,7 @@
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;
Expand Down Expand Up @@ -234,8 +236,8 @@ private String initializeSessionYaml(Map<String, String> vars) throws IOExceptio

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");
Expand All @@ -255,8 +257,8 @@ private void checkCsvResultFile() throws Exception {
} 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);
}
}

0 comments on commit 971e7b2

Please sign in to comment.