flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trohrm...@apache.org
Subject flink git commit: [tests] Hardens TaskManagerRegistrationTest.testTaskManagerResumesConnectAfterJobManagerFailure test case by checking testing actor's complete mailbox for a Terminated message
Date Tue, 18 Aug 2015 14:36:41 GMT
Repository: flink
Updated Branches:
  refs/heads/master a9d55d3ea -> 6eae11f34


[tests] Hardens TaskManagerRegistrationTest.testTaskManagerResumesConnectAfterJobManagerFailure
test case by checking testing actor's complete mailbox for a Terminated message


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

Branch: refs/heads/master
Commit: 6eae11f34943ea835eaae38651c64c98666e01d7
Parents: a9d55d3
Author: Till Rohrmann <trohrmann@apache.org>
Authored: Tue Aug 18 15:00:42 2015 +0200
Committer: Till Rohrmann <trohrmann@apache.org>
Committed: Tue Aug 18 16:35:46 2015 +0200

----------------------------------------------------------------------
 .../taskmanager/TaskManagerRegistrationTest.java | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/6eae11f3/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerRegistrationTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerRegistrationTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerRegistrationTest.java
index 6d8e656..df65019 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerRegistrationTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskManagerRegistrationTest.java
@@ -23,6 +23,7 @@ import akka.actor.ActorSystem;
 import akka.actor.InvalidActorNameException;
 import akka.actor.Kill;
 import akka.actor.Props;
+import akka.actor.Terminated;
 import akka.actor.UntypedActor;
 import akka.pattern.Patterns;
 import akka.testkit.JavaTestKit;
@@ -38,6 +39,7 @@ import org.apache.flink.runtime.messages.RegistrationMessages.RegisterTaskManage
 import org.apache.flink.runtime.messages.RegistrationMessages.RefuseRegistration;
 import org.apache.flink.runtime.messages.TaskManagerMessages;
 import org.apache.flink.runtime.testingUtils.TestingTaskManager;
+import org.apache.flink.util.TestLogger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -60,7 +62,7 @@ import static org.junit.Assert.*;
  * when connecting to the JobManager, and when the JobManager
  * is unreachable.
  */
-public class TaskManagerRegistrationTest {
+public class TaskManagerRegistrationTest extends TestLogger {
 
 	private static final Option<String> NONE_STRING = Option.empty();
 
@@ -310,11 +312,22 @@ public class TaskManagerRegistrationTest {
 				stopActor(fakeJobManager1);
 
 				// wait for the killing to be completed
-				new Within(new FiniteDuration(2, TimeUnit.SECONDS)) {
+				final FiniteDuration timeout = new FiniteDuration(2, TimeUnit.SECONDS);
+
+				new Within(timeout) {
 
 					@Override
 					protected void run() {
-						expectTerminated(fakeJobManager1);
+						Object message = null;
+
+						// we might also receive RegisterTaskManager and Heartbeat messages which
+						// are queued up in the testing actor's mailbox
+						while(message == null || !(message instanceof Terminated)) {
+							message = receiveOne(timeout);
+						}
+
+						Terminated terminatedMessage = (Terminated) message;
+						assertEquals(fakeJobManager1, terminatedMessage.actor());
 					}
 				};
 


Mime
View raw message