CGroupsCpuResourceHandlerImpl implements CpuResourceHandler { @Override public List<PrivilegedOperation> postComplete(ContainerId containerId) throws ResourceHandlerException { cGroupsHandler.deleteCGroup(CPU, containerId.toString()); return null; } CGroupsCpuResourceHandlerImpl(CGroupsHandler cGroupsHandler); @Override List<PrivilegedOperation> bootstrap(Configuration conf); @InterfaceAudience.Private static boolean cpuLimitsExist(String path); @VisibleForTesting @InterfaceAudience.Private static int[] getOverallLimits(float yarnProcessors); @Override List<PrivilegedOperation> preStart(Container container); @Override List<PrivilegedOperation> reacquireContainer(ContainerId containerId); @Override List<PrivilegedOperation> updateContainer(Container container); @Override List<PrivilegedOperation> postComplete(ContainerId containerId); @Override List<PrivilegedOperation> teardown();  }
@Test public void testPostComplete() throws Exception { String id = "container_01_01"; ContainerId mockContainerId = mock(ContainerId.class); when(mockContainerId.toString()).thenReturn(id); Assert.assertNull(cGroupsCpuResourceHandler.postComplete(mockContainerId)); verify(mockCGroupsHandler, times(1)) .deleteCGroup(CGroupsHandler.CGroupController.CPU, id); }