@Test
public void testBootstrapExistingLimits() throws Exception {

  File existingLimit = new File(CGroupsHandler.CGroupController.CPU.getName()
      + "." + CGroupsHandler.CGROUP_CPU_QUOTA_US);
  try {
    FileUtils.write(existingLimit, "10000"); // value doesn't matter
    when(mockCGroupsHandler
        .getPathForCGroup(CGroupsHandler.CGroupController.CPU, ""))
        .thenReturn(".");
    Configuration conf = new YarnConfiguration();
    List<PrivilegedOperation> ret =
        cGroupsCpuResourceHandler.bootstrap(plugin, conf);
    verify(mockCGroupsHandler, times(1))
        .initializeCGroupController(CGroupsHandler.CGroupController.CPU);
    verify(mockCGroupsHandler, times(1))
        .updateCGroupParam(CGroupsHandler.CGroupController.CPU, "",
            CGroupsHandler.CGROUP_CPU_QUOTA_US, "-1");
    Assert.assertNull(ret);
  } finally {
    FileUtils.deleteQuietly(existingLimit);
  }
}