@Test
public void testAllocationIncrementMemoryNonDefaultUnit() throws Exception {

  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RESOURCE_TYPES + "." +
      ResourceInformation.MEMORY_MB.getName() +
      FairSchedulerConfiguration.INCREMENT_ALLOCATION, "1 Gi");
  FairSchedulerConfiguration fsc = new FairSchedulerConfiguration(conf);
  Resource minimum = Resources.createResource(0L, 0);
  Resource maximum =
      Resources.createResource(Long.MAX_VALUE, Integer.MAX_VALUE);
  Resource increment = fsc.getIncrementAllocation();
  DominantResourceCalculator resourceCalculator =
      new DominantResourceCalculator();
  assertEquals(1024L, resourceCalculator.normalize(
      Resources.createResource(1023L), minimum, maximum, increment)
        .getMemorySize());
  assertEquals(1024L, resourceCalculator.normalize(
      Resources.createResource(1024L), minimum, maximum, increment)
        .getMemorySize());
  assertEquals(2048L, resourceCalculator.normalize(
      Resources.createResource(1025L), minimum, maximum, increment)
        .getMemorySize());
}