### Question:
CgroupsLCEResourcesHandler implements LCEResourcesHandler { @VisibleForTesting boolean deleteCgroup(String cgroupPath) { boolean deleted; if (LOG.isDebugEnabled()) { LOG.debug("deleteCgroup: " + cgroupPath); } long start = clock.getTime(); do { deleted = new File(cgroupPath).delete(); if (!deleted) { try { Thread.sleep(20); } catch (InterruptedException ex) { } } } while (!deleted && (clock.getTime() - start) < deleteCgroupTimeout); if (!deleted) { LOG.warn("Unable to delete cgroup at: " + cgroupPath + ", tried to delete for " + deleteCgroupTimeout + "ms"); } return deleted; } CgroupsLCEResourcesHandler(); @Override void setConf(Configuration conf); @Override Configuration getConf(); void init(LinuxContainerExecutor lce); void preExecute(ContainerId containerId, Resource containerResource); void postExecute(ContainerId containerId); String getResourcesOption(ContainerId containerId);  }### Answer:
@Test public void testDeleteCgroup() throws Exception { final MockClock clock = new MockClock(); clock.time = System.currentTimeMillis(); CgroupsLCEResourcesHandler handler = new CgroupsLCEResourcesHandler(); handler.setConf(new YarnConfiguration()); handler.initConfig(); handler.clock = clock; File file = new File("target", UUID.randomUUID().toString()); new FileOutputStream(file).close(); Assert.assertTrue(handler.deleteCgroup(file.getPath())); final CountDownLatch latch = new CountDownLatch(1); new Thread() { @Override public void run() { latch.countDown(); try { Thread.sleep(200); } catch (InterruptedException ex) { } clock.time += YarnConfiguration. DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT; } }.start(); latch.await(); file = new File("target", UUID.randomUUID().toString()); Assert.assertFalse(handler.deleteCgroup(file.getPath())); }