You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2019/01/31 13:28:59 UTC

[flink] branch master updated: [FLINK-11380][tests] Finish mocking of resourceManagerClient before using it

This is an automated email from the ASF dual-hosted git repository.

trohrmann 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 c68bb9e  [FLINK-11380][tests] Finish mocking of resourceManagerClient before using it
c68bb9e is described below

commit c68bb9efb04bf518b776c70faf882c1173958166
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Thu Jan 31 11:18:42 2019 +0100

    [FLINK-11380][tests] Finish mocking of resourceManagerClient before using it
    
    The problem was that we started the ResourceManager before we finished the mocking of the
    resourceManagerClient. This lead then to concurrent modifications of the mock which made
    the test fail.
---
 .../java/org/apache/flink/yarn/YarnFlinkResourceManagerTest.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/flink-yarn/src/test/java/org/apache/flink/yarn/YarnFlinkResourceManagerTest.java b/flink-yarn/src/test/java/org/apache/flink/yarn/YarnFlinkResourceManagerTest.java
index 4108249..246b841 100644
--- a/flink-yarn/src/test/java/org/apache/flink/yarn/YarnFlinkResourceManagerTest.java
+++ b/flink-yarn/src/test/java/org/apache/flink/yarn/YarnFlinkResourceManagerTest.java
@@ -115,6 +115,9 @@ public class YarnFlinkResourceManagerTest extends TestLogger {
 			int numInitialTaskManagers = 5;
 			final YarnResourceManagerCallbackHandler callbackHandler = new YarnResourceManagerCallbackHandler();
 			AMRMClientAsync<AMRMClient.ContainerRequest> resourceManagerClient = mock(AMRMClientAsync.class);
+			doReturn(Collections.singletonList(Collections.nCopies(numInitialTaskManagers, new AMRMClient.ContainerRequest(Resource.newInstance(1024 * 1024, 1), null, null, Priority.newInstance(0)))))
+				.when(resourceManagerClient).getMatchingRequests(any(Priority.class), anyString(), any(Resource.class));
+
 			NMClient nodeManagerClient = mock(NMClient.class);
 			UUID leaderSessionID = UUID.randomUUID();
 
@@ -181,9 +184,6 @@ public class YarnFlinkResourceManagerTest extends TestLogger {
 						nodeManagerClient
 					));
 
-				doReturn(Collections.singletonList(Collections.nCopies(numInitialTaskManagers, new AMRMClient.ContainerRequest(Resource.newInstance(1024 * 1024, 1), null, null, Priority.newInstance(0)))))
-					.when(resourceManagerClient).getMatchingRequests(any(Priority.class), anyString(), any(Resource.class));
-
 				leaderRetrievalService.notifyListener(leader1.path().toString(), leaderSessionID);
 
 				final AkkaActorGateway leader1Gateway = new AkkaActorGateway(leader1, leaderSessionID);