PawasChhokra commented on a change in pull request #1422:
URL: https://github.com/apache/samza/pull/1422#discussion_r480244117
##########
File path:
samza-yarn/src/test/java/org/apache/samza/job/yarn/TestYarnClusterResourceManager.java
##########
@@ -103,4 +104,30 @@ public void testAllocatedResourceExpiryForYarn() {
Assert.assertTrue(yarnClusterResourceManager.isResourceExpired(allocatedResource));
}
+
+ @Test
+ public void testAMShutdownOnRMCallback() {
+ // create mocks
+ YarnConfiguration yarnConfiguration = mock(YarnConfiguration.class);
+ SamzaAppMasterMetrics metrics = mock(SamzaAppMasterMetrics.class);
+ Config config = mock(Config.class);
+ AMRMClientAsync asyncClient = mock(AMRMClientAsync.class);
+ YarnAppState yarnAppState = new YarnAppState(0, mock(ContainerId.class),
"host", 8080, 8081);
+ SamzaYarnAppMasterLifecycle lifecycle =
mock(SamzaYarnAppMasterLifecycle.class);
+ SamzaYarnAppMasterService service = mock(SamzaYarnAppMasterService.class);
+ NMClientAsync asyncNMClient = mock(NMClientAsync.class);
+ ClusterResourceManager.Callback callback =
mock(ClusterResourceManager.Callback.class);
+
+ // start the cluster manager
+ YarnClusterResourceManager yarnClusterResourceManager = new
YarnClusterResourceManager(asyncClient, asyncNMClient,
+ callback, yarnAppState, lifecycle, service, metrics,
yarnConfiguration, config);
+
+ yarnClusterResourceManager.onShutdownRequest();
+
+ verify(lifecycle,
times(1)).onShutdown(SamzaApplicationState.SamzaAppStatus.FAILED);
Review comment:
Done.
----------------------------------------------------------------
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:
[email protected]