KarmaGYZ commented on a change in pull request #11248: [FLINK-16299] Release containers recovered from previous attempt in w… URL: https://github.com/apache/flink/pull/11248#discussion_r386029438
########## File path: flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerTest.java ########## @@ -321,9 +322,16 @@ void runTest(RunnableWithException testMethod) throws Exception { } } - void verifyContainerHasBeenStarted(Container testingContainer) { + void verifyContainerHasBeenStarted(Container testingContainer, List<ContainerId> startedContainerIds) throws Exception { verify(mockResourceManagerClient, VERIFICATION_TIMEOUT).removeContainerRequest(any(AMRMClient.ContainerRequest.class)); - verify(mockNMClient, VERIFICATION_TIMEOUT).startContainerAsync(eq(testingContainer), any(ContainerLaunchContext.class)); + // Wait the call of + for (int i = 0; i < TIMEOUT.toMilliseconds(); i += 1000) { + if (startedContainerIds.contains(testingContainer.getId())) { + return; + } + Thread.sleep(1000); + } + throw new Exception("The container has not been start before timeout."); Review comment: Yes, you are right. I think we could fix it by using `CopyOnWriteArrayList`. Is there any extra benefit of leveraging the `CompletableFuture` mechanism? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services