You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/07/15 09:16:49 UTC
[flink] 01/02: [FLINK-13243][tests] Simplify exception matching
This is an automated email from the ASF dual-hosted git repository.
chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 60432798fc68d507d76e652e36ce92b5f5cb5d0c
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Fri Jul 12 11:55:24 2019 +0200
[FLINK-13243][tests] Simplify exception matching
---
.../operator/restore/AbstractOperatorRestoreTestBase.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/AbstractOperatorRestoreTestBase.java b/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/AbstractOperatorRestoreTestBase.java
index c857421..86a8aaa 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/AbstractOperatorRestoreTestBase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/AbstractOperatorRestoreTestBase.java
@@ -48,6 +48,7 @@ import java.net.URL;
import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -65,6 +66,13 @@ public abstract class AbstractOperatorRestoreTestBase extends TestLogger {
private static final int NUM_TMS = 1;
private static final int NUM_SLOTS_PER_TM = 4;
private static final Duration TEST_TIMEOUT = Duration.ofSeconds(10000L);
+ private static final Pattern PATTERN_CANCEL_WITH_SAVEPOINT_TOLERATED_EXCEPTIONS = Pattern
+ .compile(
+ "(savepoint for the job .* failed)" +
+ "|(was not running)" +
+ "|(Not all required tasks are currently running)" +
+ "|(Checkpoint was declined \\(tasks not ready\\))"
+ );
@Rule
public final TemporaryFolder tmpFolder = new TemporaryFolder();
@@ -140,10 +148,7 @@ public abstract class AbstractOperatorRestoreTestBase extends TestLogger {
targetDirectory.getAbsolutePath());
} catch (Exception e) {
String exceptionString = ExceptionUtils.stringifyException(e);
- if (!(exceptionString.matches("(.*\n)*.*savepoint for the job .* failed(.*\n)*") // legacy
- || exceptionString.matches("(.*\n)*.*was not running(.*\n)*")
- || exceptionString.matches("(.*\n)*.*Not all required tasks are currently running(.*\n)*") // new
- || exceptionString.matches("(.*\n)*.*Checkpoint was declined \\(tasks not ready\\)(.*\n)*"))) { // new
+ if (!PATTERN_CANCEL_WITH_SAVEPOINT_TOLERATED_EXCEPTIONS.matcher(exceptionString).find()) {
throw e;
}
}