You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/10/16 22:26:26 UTC

[GitHub] tillrohrmann closed pull request #6841: [FLINK-10405] [tests] Port JobManagerFailsITCase to new code base

tillrohrmann closed pull request #6841: [FLINK-10405] [tests] Port JobManagerFailsITCase to new code base
URL: https://github.com/apache/flink/pull/6841
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureBatchRecoveryITCase.java b/flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureRecoveryITCase.java
similarity index 98%
rename from flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureBatchRecoveryITCase.java
rename to flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureRecoveryITCase.java
index 9e9ce076197..ec3f1e1b9d3 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureBatchRecoveryITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAProcessFailureRecoveryITCase.java
@@ -93,7 +93,7 @@
  */
 @SuppressWarnings("serial")
 @RunWith(Parameterized.class)
-public class JobManagerHAProcessFailureBatchRecoveryITCase extends TestLogger {
+public class JobManagerHAProcessFailureRecoveryITCase extends TestLogger {
 
 	private static ZooKeeperTestEnvironment zooKeeper;
 
@@ -131,7 +131,7 @@ public static void tearDown() throws Exception {
 
 	private final ExecutionMode executionMode;
 
-	public JobManagerHAProcessFailureBatchRecoveryITCase(ExecutionMode executionMode) {
+	public JobManagerHAProcessFailureRecoveryITCase(ExecutionMode executionMode) {
 		this.executionMode = executionMode;
 	}
 
@@ -369,9 +369,9 @@ public void run() {
 				leaderRetrievalService.stop();
 			}
 
-			for (DispatcherProcess jmProces : dispatcherProcesses) {
-				if (jmProces != null) {
-					jmProces.destroy();
+			for (DispatcherProcess dispatcherProcess : dispatcherProcesses) {
+				if (dispatcherProcess != null) {
+					dispatcherProcess.destroy();
 				}
 			}
 
diff --git a/flink-tests/src/test/scala/org/apache/flink/api/scala/runtime/jobmanager/JobManagerFailsITCase.scala b/flink-tests/src/test/scala/org/apache/flink/api/scala/runtime/jobmanager/JobManagerFailsITCase.scala
deleted file mode 100644
index 5c9b1fb0c23..00000000000
--- a/flink-tests/src/test/scala/org/apache/flink/api/scala/runtime/jobmanager/JobManagerFailsITCase.scala
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.api.scala.runtime.jobmanager
-
-import akka.actor.ActorSystem
-import akka.testkit.{ImplicitSender, TestKit}
-import org.apache.flink.configuration.{ConfigConstants, Configuration, JobManagerOptions, TaskManagerOptions}
-import org.apache.flink.runtime.akka.{AkkaUtils, ListeningBehaviour}
-import org.apache.flink.runtime.jobgraph.{JobGraph, JobVertex}
-import org.apache.flink.runtime.messages.Acknowledge
-import org.apache.flink.runtime.messages.JobManagerMessages._
-import org.apache.flink.runtime.testingUtils.TestingJobManagerMessages.NotifyWhenAtLeastNumTaskManagerAreRegistered
-import org.apache.flink.runtime.testingUtils.TestingMessages.DisableDisconnect
-import org.apache.flink.runtime.testingUtils.{ScalaTestingUtils, TestingCluster, TestingUtils}
-import org.apache.flink.runtime.testtasks.{BlockingNoOpInvokable, NoOpInvokable}
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
-
-@RunWith(classOf[JUnitRunner])
-class JobManagerFailsITCase(_system: ActorSystem)
-  extends TestKit(_system)
-  with ImplicitSender
-  with WordSpecLike
-  with Matchers
-  with BeforeAndAfterAll
-  with ScalaTestingUtils {
-
-  def this() = this(ActorSystem("TestingActorSystem", AkkaUtils.getDefaultAkkaConfig))
-
-  override def afterAll(): Unit = {
-    TestKit.shutdownActorSystem(system)
-  }
-
-  "A TaskManager" should {
-    "detect a lost connection to the JobManager and try to reconnect to it" in {
-
-      val num_slots = 4
-      val cluster = startDeathwatchCluster(num_slots, 1)
-
-      try {
-        val tm = cluster.getTaskManagers(0)
-        val jmGateway = cluster.getLeaderGateway(TestingUtils.TESTING_DURATION)
-
-        // disable disconnect message to test death watch
-        tm ! DisableDisconnect
-
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(RequestNumberRegisteredTaskManager, self)
-          expectMsg(1)
-
-          // stop the current leader and make sure that he is gone
-          TestingUtils.stopActorGracefully(jmGateway)
-
-          cluster.restartLeadingJobManager()
-
-          cluster.waitForTaskManagersToBeRegistered()
-
-          cluster.getLeaderGateway(TestingUtils.TESTING_DURATION)
-            .tell(RequestNumberRegisteredTaskManager, self)
-
-          expectMsg(1)
-        }
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "go into a clean state in case of a JobManager failure" in {
-      val num_slots = 4
-
-      val sender = new JobVertex("BlockingSender")
-      sender.setParallelism(num_slots)
-      sender.setInvokableClass(classOf[BlockingNoOpInvokable])
-      val jobGraph = new JobGraph("Blocking Testjob", sender)
-
-      val noOp = new JobVertex("NoOpInvokable")
-      noOp.setParallelism(num_slots)
-      noOp.setInvokableClass(classOf[NoOpInvokable])
-      val jobGraph2 = new JobGraph("NoOp Testjob", noOp)
-
-      val cluster = startDeathwatchCluster(num_slots / 2, 2)
-
-      try {
-        var jmGateway = cluster.getLeaderGateway(TestingUtils.TESTING_DURATION)
-        val tm = cluster.getTaskManagers(0)
-
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.DETACHED), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          // stop the current leader and make sure that he is gone
-          TestingUtils.stopActorGracefully(jmGateway)
-
-          cluster.restartLeadingJobManager()
-
-          jmGateway = cluster.getLeaderGateway(TestingUtils.TESTING_DURATION)
-
-          // Ask the job manager for the TMs. Don't ask the TMs, because they
-          // can still have state associated with the old job manager.
-          jmGateway.tell(NotifyWhenAtLeastNumTaskManagerAreRegistered(2), self)
-          expectMsg(Acknowledge.get())
-
-          jmGateway.tell(SubmitJob(jobGraph2, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph2.getJobID()))
-
-          val result = expectMsgType[JobResultSuccess]
-
-          result.result.getJobId() should equal(jobGraph2.getJobID)
-        }
-      } finally {
-        cluster.stop()
-      }
-    }
-  }
-
-  def startDeathwatchCluster(numSlots: Int, numTaskmanagers: Int): TestingCluster = {
-    val config = new Configuration()
-    config.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, numSlots)
-    config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, numTaskmanagers)
-    config.setInteger(JobManagerOptions.PORT, 0)
-    config.setString(TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF, "50 ms")
-    config.setString(TaskManagerOptions.REGISTRATION_MAX_BACKOFF, "100 ms")
-
-    val cluster = new TestingCluster(config, singleActorSystem = false)
-
-    cluster.start()
-
-    cluster
-  }
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services