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 2020/04/09 06:56:03 UTC

[GitHub] [flink] zentol commented on a change in pull request #11667: [FLINK-15936] Harden TaskExecutorTest#testSlotAcceptance

zentol commented on a change in pull request #11667: [FLINK-15936] Harden TaskExecutorTest#testSlotAcceptance
URL: https://github.com/apache/flink/pull/11667#discussion_r405987107
 
 

 ##########
 File path: flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskExecutorTest.java
 ##########
 @@ -988,6 +945,43 @@ public void testSubmitTaskBeforeAcceptSlot() throws Exception {
 		}
 	}
 
+	private TestingResourceManagerGateway createRmWithTmRegisterAndNotifySlotHooks(
+			InstanceID registrationId,
+			OneShotLatch taskExecutorIsRegistered,
+			CompletableFuture<Tuple3<InstanceID, SlotID, AllocationID>> availableSlotFuture) {
+		final TestingResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
+		resourceManagerLeaderRetriever.notifyListener(
+			resourceManagerGateway.getAddress(),
+			resourceManagerGateway.getFencingToken().toUUID());
+
+		resourceManagerGateway.setRegisterTaskExecutorFunction(
+			taskExecutorRegistration -> CompletableFuture.completedFuture(
+				new TaskExecutorRegistrationSuccess(registrationId, resourceManagerGateway.getOwnResourceId(),
+					new ClusterInformation("localhost", 1234))));
+
+		resourceManagerGateway.setNotifySlotAvailableConsumer(availableSlotFuture::complete);
+
+		resourceManagerGateway.setSendSlotReportFunction(ignored -> {
+			taskExecutorIsRegistered.trigger();
+			return CompletableFuture.completedFuture(Acknowledge.get());
+		});
+		return resourceManagerGateway;
+	}
+
+	private TaskManagerServices createTaskManagerServicesWithTaskSlotTable(
+			TaskSlotTable<Task> taskSlotTable) throws IOException {
+		return new TaskManagerServicesBuilder()
+			.setUnresolvedTaskManagerLocation(unresolvedTaskManagerLocation)
+			.setShuffleEnvironment(nettyShuffleEnvironment)
+			.setTaskSlotTable(taskSlotTable)
+			.setJobLeaderService(new JobLeaderService(
+				unresolvedTaskManagerLocation,
+				RetryingRegistrationConfiguration.defaultConfiguration()))
+			.setJobManagerTable(new JobManagerTable())
+			.setTaskStateManager( createTaskExecutorLocalStateStoresManager())
 
 Review comment:
   remove leading space

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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