@Test
public void testBootstrap() throws Exception {

  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.NM_PMEM_CHECK_ENABLED, false);
  conf.setBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, false);
  List<PrivilegedOperation> ret =
      cGroupsMemoryResourceHandler.bootstrap(conf);
  verify(mockCGroupsHandler, times(1))
      .initializeCGroupController(CGroupsHandler.CGroupController.MEMORY);
  Assert.assertNull(ret);
  Assert.assertEquals("Default swappiness value incorrect", 0,
      cGroupsMemoryResourceHandler.getSwappiness());
  conf.setBoolean(YarnConfiguration.NM_PMEM_CHECK_ENABLED, true);
  try {
    cGroupsMemoryResourceHandler.bootstrap(conf);
  } catch(ResourceHandlerException re) {
    Assert.fail("Pmem check should be allowed to run with cgroups");
  }
  conf.setBoolean(YarnConfiguration.NM_PMEM_CHECK_ENABLED, false);
  conf.setBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, true);
  try {
    cGroupsMemoryResourceHandler.bootstrap(conf);
  } catch(ResourceHandlerException re) {
    Assert.fail("Vmem check should be allowed to run with cgroups");
  }
}