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/02/20 10:38:29 UTC

[flink] branch master updated: [FLINK-10569][runtime] Remove Instance usage in ExecutionVertexSchedulingTest

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


The following commit(s) were added to refs/heads/master by this push:
     new 773f711  [FLINK-10569][runtime] Remove Instance usage in ExecutionVertexSchedulingTest
773f711 is described below

commit 773f711ba45bc7388453980c258c2501ad014fa3
Author: ZiLi Chen <wa...@gmail.com>
AuthorDate: Wed Feb 20 18:38:21 2019 +0800

    [FLINK-10569][runtime] Remove Instance usage in ExecutionVertexSchedulingTest
---
 .../ExecutionVertexSchedulingTest.java             | 32 ++++++++--------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionVertexSchedulingTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionVertexSchedulingTest.java
index abb58c7..855d2a7 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionVertexSchedulingTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionVertexSchedulingTest.java
@@ -20,14 +20,10 @@ package org.apache.flink.runtime.executiongraph;
 
 import org.apache.flink.runtime.akka.AkkaUtils;
 import org.apache.flink.runtime.execution.ExecutionState;
-import org.apache.flink.runtime.instance.DummyActorGateway;
-import org.apache.flink.runtime.instance.Instance;
-import org.apache.flink.runtime.instance.SimpleSlot;
 import org.apache.flink.runtime.jobgraph.JobVertexID;
 import org.apache.flink.runtime.jobmanager.scheduler.LocationPreferenceConstraint;
-import org.apache.flink.runtime.jobmanager.slots.ActorTaskManagerGateway;
 import org.apache.flink.runtime.jobmaster.LogicalSlot;
-import org.apache.flink.runtime.testingUtils.TestingUtils;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlot;
 import org.apache.flink.util.TestLogger;
 
 import org.junit.Test;
@@ -36,9 +32,8 @@ import java.util.Collections;
 import java.util.concurrent.CompletableFuture;
 
 import static org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils.getExecutionVertex;
-import static org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils.getInstance;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
 public class ExecutionVertexSchedulingTest extends TestLogger {
@@ -51,11 +46,10 @@ public class ExecutionVertexSchedulingTest extends TestLogger {
 					AkkaUtils.getDefaultTimeout());
 
 			// a slot than cannot be deployed to
-			final Instance instance = getInstance(new ActorTaskManagerGateway(DummyActorGateway.INSTANCE));
-			final SimpleSlot slot = instance.allocateSimpleSlot();
-			
-			slot.releaseSlot();
-			assertTrue(slot.isReleased());
+			final LogicalSlot slot = new TestingLogicalSlot();
+			slot.releaseSlot(new Exception("Test Exception"));
+
+			assertFalse(slot.isAlive());
 
 			CompletableFuture<LogicalSlot> future = new CompletableFuture<>();
 			future.complete(slot);
@@ -81,11 +75,10 @@ public class ExecutionVertexSchedulingTest extends TestLogger {
 					AkkaUtils.getDefaultTimeout());
 
 			// a slot than cannot be deployed to
-			final Instance instance = getInstance(new ActorTaskManagerGateway(DummyActorGateway.INSTANCE));
-			final SimpleSlot slot = instance.allocateSimpleSlot();
+			final LogicalSlot slot = new TestingLogicalSlot();
+			slot.releaseSlot(new Exception("Test Exception"));
 
-			slot.releaseSlot();
-			assertTrue(slot.isReleased());
+			assertFalse(slot.isAlive());
 
 			final CompletableFuture<LogicalSlot> future = new CompletableFuture<>();
 
@@ -118,12 +111,9 @@ public class ExecutionVertexSchedulingTest extends TestLogger {
 			final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0],
 					AkkaUtils.getDefaultTimeout());
 
-			final Instance instance = getInstance(new ActorTaskManagerGateway(
-				new ExecutionGraphTestUtils.SimpleActorGateway(TestingUtils.defaultExecutionContext())));
-			final SimpleSlot slot = instance.allocateSimpleSlot();
+			final LogicalSlot slot = new TestingLogicalSlot();
 
-			CompletableFuture<LogicalSlot> future = new CompletableFuture<>();
-			future.complete(slot);
+			CompletableFuture<LogicalSlot> future = CompletableFuture.completedFuture(slot);
 
 			assertEquals(ExecutionState.CREATED, vertex.getExecutionState());