You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2016/12/20 16:49:12 UTC

[07/10] flink git commit: [hotfix] [tests] Fix instability in TimestampITCase

[hotfix] [tests] Fix instability in TimestampITCase


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/7280df48
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/7280df48
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/7280df48

Branch: refs/heads/master
Commit: 7280df4896939d72e83e67d9b2a2de7449f03ba3
Parents: 3a6585d
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Dec 20 14:49:31 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Tue Dec 20 17:01:44 2016 +0100

----------------------------------------------------------------------
 .../test/streaming/runtime/TimestampITCase.java | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/7280df48/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java
index 59bab7d..13add4b 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/TimestampITCase.java
@@ -204,16 +204,29 @@ public class TimestampITCase extends TestLogger {
 					// try until we get the running jobs
 					List<JobID> running;
 					while ((running = cluster.getCurrentlyRunningJobsJava()).isEmpty()) {
-						Thread.sleep(50);
+						Thread.sleep(10);
 					}
 
 					JobID id = running.get(0);
 					
 					// send stop until the job is stopped
 					do {
-						cluster.stopJob(id);
-						Thread.sleep(50);
-					} while (!cluster.getCurrentlyRunningJobsJava().isEmpty());
+						try {
+							cluster.stopJob(id);
+						}
+						catch (Exception e) {
+							if (e.getCause() instanceof IllegalStateException) {
+								// this means the job is not yet ready to be stopped,
+								// for example because it is still in CREATED state
+								// we ignore the exception 
+							} else {
+								// other problem
+								throw e;
+							}
+						}
+						Thread.sleep(10);
+					}
+					while (!cluster.getCurrentlyRunningJobsJava().isEmpty());
 				}
 				catch (Throwable t) {
 					t.printStackTrace();