@Test
public void testGetVCores() {

  ResourceCalculatorPlugin plugin = new TestResourceCalculatorPlugin();
  YarnConfiguration conf = new YarnConfiguration();
  conf.setFloat(YarnConfiguration.NM_PCORES_VCORES_MULTIPLIER, 1.25f);
  int ret = NodeManagerHardwareUtils.getVCores(plugin, conf);
  Assert.assertEquals(YarnConfiguration.DEFAULT_NM_VCORES, ret);
  conf.setBoolean(YarnConfiguration.NM_ENABLE_HARDWARE_CAPABILITY_DETECTION,
      true);
  ret = NodeManagerHardwareUtils.getVCores(plugin, conf);
  Assert.assertEquals(5, ret);
  conf.setBoolean(YarnConfiguration.NM_COUNT_LOGICAL_PROCESSORS_AS_CORES,
      true);
  ret = NodeManagerHardwareUtils.getVCores(plugin, conf);
  Assert.assertEquals(10, ret);
  conf.setInt(YarnConfiguration.NM_VCORES, 10);
  ret = NodeManagerHardwareUtils.getVCores(plugin, conf);
  Assert.assertEquals(10, ret);
  YarnConfiguration conf1 = new YarnConfiguration();
  conf1.setBoolean(YarnConfiguration.NM_ENABLE_HARDWARE_CAPABILITY_DETECTION,
      false);
  conf.setInt(YarnConfiguration.NM_VCORES, 10);
  ret = NodeManagerHardwareUtils.getVCores(plugin, conf);
  Assert.assertEquals(10, ret);
}