This is an automated email from the ASF dual-hosted git repository.
jeagles pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new b23a585 YARN-10256. Refactor
TestContainerSchedulerQueuing.testContainerUpdateExecTypeGuaranteedToOpportunistic
(Ahmed Hussein via jeagles)
b23a585 is described below
commit b23a585cb1dd2b4317334554187621a5084c8215
Author: Ahmed Hussein <[email protected]>
AuthorDate: Mon May 4 10:13:51 2020 -0500
YARN-10256. Refactor
TestContainerSchedulerQueuing.testContainerUpdateExecTypeGuaranteedToOpportunistic
(Ahmed Hussein via jeagles)
Signed-off-by: Jonathan Eagles <[email protected]>
(cherry picked from commit f5081a9a5d51fe781da97f07ac4dca8dd49c98e2)
---
.../scheduler/TestContainerSchedulerQueuing.java | 52 ++++++++--------------
1 file changed, 19 insertions(+), 33 deletions(-)
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerQueuing.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerQueuing.java
index 258c5be..0289a2c 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerQueuing.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerQueuing.java
@@ -28,7 +28,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import com.google.common.base.Supplier;
import org.apache.hadoop.fs.UnsupportedFileSystemException;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.GenericTestUtils;
@@ -1266,37 +1265,24 @@ public class TestContainerSchedulerQueuing extends
BaseContainerManagerTest {
1, updateResponse.getSuccessfullyUpdatedContainers().size());
Assert.assertTrue(updateResponse.getFailedRequests().isEmpty());
- GetContainerStatusesRequest statRequest =
-
GetContainerStatusesRequest.newInstance(Collections.singletonList(cId));
- GenericTestUtils.waitFor(
- new Supplier<Boolean>() {
- @Override
- public Boolean get() {
- try {
- List<ContainerStatus> containerStatuses = containerManager
- .getContainerStatuses(statRequest).getContainerStatuses();
- Assert.assertEquals(1, containerStatuses.size());
-
- ContainerStatus status = containerStatuses.get(0);
- Assert.assertEquals(
- org.apache.hadoop.yarn.api.records.ContainerState.RUNNING,
- status.getState());
-
- return status.getExecutionType() == ExecutionType.OPPORTUNISTIC;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
- }, 100, 10000);
- List<ContainerStatus> containerStatuses = containerManager
- .getContainerStatuses(statRequest).getContainerStatuses();
- Assert.assertEquals(1, containerStatuses.size());
- for (ContainerStatus status : containerStatuses) {
- Assert.assertEquals(
- org.apache.hadoop.yarn.api.records.ContainerState.RUNNING,
- status.getState());
- Assert
- .assertEquals(ExecutionType.OPPORTUNISTIC,
status.getExecutionType());
- }
+ final GetContainerStatusesRequest statRequest =
+ GetContainerStatusesRequest.newInstance(
+ Collections.singletonList(cId));
+ final org.apache.hadoop.yarn.api.records.ContainerState expectedState =
+ org.apache.hadoop.yarn.api.records.ContainerState.RUNNING;
+
+ GenericTestUtils.waitFor(() -> {
+ List<ContainerStatus> containerStatuses;
+ try {
+ containerStatuses = containerManager
+ .getContainerStatuses(statRequest).getContainerStatuses();
+ } catch (YarnException | IOException e) {
+ return false;
+ }
+ Assert.assertEquals(1, containerStatuses.size());
+ ContainerStatus status = containerStatuses.get(0);
+ return (status.getState() == expectedState
+ && status.getExecutionType() == ExecutionType.OPPORTUNISTIC);
+ }, 20, 10000);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]