Sanil15 commented on a change in pull request #1152: SAMZA-2319: [1/2] Simplify
Container Allocation logic
URL: https://github.com/apache/samza/pull/1152#discussion_r329214331
##########
File path:
samza-core/src/test/java/org/apache/samza/clustermanager/TestContainerAllocatorWithHostAffinity.java
##########
@@ -350,6 +358,146 @@ public void testExpiredRequestsAreCancelled() throws
Exception {
Assert.assertEquals(clusterResourceManager.cancelledRequests.size(), 3);
}
+ @Test
+ public void testRequestAllocationOnPreferredHostWithRunStreamProcessor()
throws Exception {
+ ClusterResourceManager.Callback mockCPM =
mock(MockClusterResourceManagerCallback.class);
+ // Mock the callback from ClusterManager to add resources to the allocator
+ doAnswer((InvocationOnMock invocation) -> {
+ SamzaResource resource = (SamzaResource) invocation.getArgumentAt(0,
List.class).get(0);
+ spyAllocator.addResource(resource);
+ return null;
+ }).when(mockCPM).onResourcesAvailable(anyList());
+
+ spyAllocator = Mockito.spy(
+ new AbstractContainerAllocator(new MockClusterResourceManager(mockCPM,
state), config, state,
+ getClass().getClassLoader(), true, Optional.empty()));
+
+ // Request Resources
+ spyAllocator.requestResources(new HashMap<String, String>() {
+ {
+ put("0", "abc");
Review comment:
yes
----------------------------------------------------------------
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]
With regards,
Apache Git Services