|
26 | 26 | import java.io.FileReader; |
27 | 27 | import java.io.IOException; |
28 | 28 | import java.io.PrintWriter; |
29 | | -import java.util.ArrayList; |
30 | 29 | import java.util.Arrays; |
31 | 30 | import java.util.HashMap; |
32 | 31 | import java.util.List; |
|
58 | 57 | import org.apache.hadoop.yarn.server.api.ResourceManagerConstants; |
59 | 58 | import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent; |
60 | 59 | import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.ExitCode; |
61 | | -import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor.Signal; |
62 | 60 | import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor; |
63 | 61 | import org.apache.hadoop.yarn.server.nodemanager.DeletionService; |
64 | | -import org.apache.hadoop.yarn.server.nodemanager.LocalRMInterface; |
65 | | -import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdater; |
66 | | -import org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl; |
67 | 62 | import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState; |
68 | 63 | import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ContainerLocalizer; |
69 | 64 | import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService; |
@@ -161,6 +156,7 @@ public void testContainerSetup() throws IOException, InterruptedException { |
161 | 156 | when(mockContainer.getNodeId()).thenReturn(context.getNodeId()); |
162 | 157 | when(mockContainer.getNodeHttpAddress()).thenReturn( |
163 | 158 | context.getNodeId().getHost() + ":12345"); |
| 159 | + when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER); |
164 | 160 |
|
165 | 161 | StartContainerRequest startRequest = |
166 | 162 | recordFactory.newRecordInstance(StartContainerRequest.class); |
@@ -259,6 +255,7 @@ public void testContainerLaunchAndStop() throws IOException, |
259 | 255 | when(mockContainer.getNodeId()).thenReturn(context.getNodeId()); |
260 | 256 | when(mockContainer.getNodeHttpAddress()).thenReturn( |
261 | 257 | context.getNodeId().getHost() + ":12345"); |
| 258 | + when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER); |
262 | 259 |
|
263 | 260 | StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class); |
264 | 261 | startRequest.setContainerLaunchContext(containerLaunchContext); |
@@ -370,6 +367,8 @@ private void testContainerLaunchAndExit(int exitCode) throws IOException, Interr |
370 | 367 | when(mockContainer.getNodeId()).thenReturn(context.getNodeId()); |
371 | 368 | when(mockContainer.getNodeHttpAddress()).thenReturn( |
372 | 369 | context.getNodeId().getHost() + ":12345"); |
| 370 | + when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER); |
| 371 | + |
373 | 372 | StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class); |
374 | 373 | startRequest.setContainerLaunchContext(containerLaunchContext); |
375 | 374 | startRequest.setContainer(mockContainer); |
@@ -470,6 +469,7 @@ public void setBlockNewContainerRequests( |
470 | 469 | when(mockContainer.getNodeId()).thenReturn(context.getNodeId()); |
471 | 470 | when(mockContainer.getNodeHttpAddress()).thenReturn( |
472 | 471 | context.getNodeId().getHost() + ":12345"); |
| 472 | + when(mockContainer.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER); |
473 | 473 |
|
474 | 474 | // containerLaunchContext.command = new ArrayList<CharSequence>(); |
475 | 475 |
|
@@ -541,19 +541,6 @@ public void setBlockNewContainerRequests( |
541 | 541 | @Test |
542 | 542 | public void testContainerLaunchFromPreviousRM() throws IOException, |
543 | 543 | InterruptedException { |
544 | | - // There is no real RM registration, simulate and set RMIdentifier |
545 | | - NodeStatusUpdater nodeStatusUpdater = mock(NodeStatusUpdater.class); |
546 | | - when(nodeStatusUpdater.getRMIdentifier()).thenReturn((long) 1234); |
547 | | - containerManager = |
548 | | - new ContainerManagerImpl(context, exec, delSrvc, nodeStatusUpdater, |
549 | | - metrics, new ApplicationACLsManager(conf), dirsHandler) { |
550 | | - @Override |
551 | | - public void setBlockNewContainerRequests( |
552 | | - boolean blockNewContainerRequests) { |
553 | | - // do nothing |
554 | | - } |
555 | | - }; |
556 | | - containerManager.init(conf); |
557 | 544 | containerManager.start(); |
558 | 545 |
|
559 | 546 | ContainerLaunchContext containerLaunchContext = |
@@ -595,7 +582,8 @@ public void setBlockNewContainerRequests( |
595 | 582 | // Construct the Container with a RMIdentifier within current RM |
596 | 583 | Container mockContainer2 = mock(Container.class); |
597 | 584 | when(mockContainer2.getId()).thenReturn(cId2); |
598 | | - when(mockContainer2.getRMIdentifer()).thenReturn((long) 1234); |
| 585 | + when(mockContainer2.getRMIdentifer()).thenReturn(super.DUMMY_RM_IDENTIFIER); |
| 586 | + |
599 | 587 | when(mockContainer2.getResource()).thenReturn(mockResource); |
600 | 588 | StartContainerRequest startRequest2 = |
601 | 589 | recordFactory.newRecordInstance(StartContainerRequest.class); |
|
0 commit comments