public static boolean isRuncContainerRequested(Configuration daemonConf,
      Map<String, String> env) {
    String type = (env == null)
        ? null : env.get(ContainerRuntimeConstants.ENV_CONTAINER_TYPE);
    if (type == null) {
      type = daemonConf.get(YarnConfiguration.LINUX_CONTAINER_RUNTIME_TYPE);
    }
    return type != null && type.equals(
        ContainerRuntimeConstants.CONTAINER_RUNTIME_RUNC);
  }
@Test
  public void testSelectRuncContainerTypeWithDefaultSet() {
    Map<String, String> envRuncType = new HashMap<>();
    Map<String, String> envOtherType = new HashMap<>();

    conf.set(YarnConfiguration.LINUX_CONTAINER_RUNTIME_TYPE, "default");
    envRuncType.put(ContainerRuntimeConstants.ENV_CONTAINER_TYPE,
        ContainerRuntimeConstants.CONTAINER_RUNTIME_RUNC);
    envOtherType.put(ContainerRuntimeConstants.ENV_CONTAINER_TYPE, "other");

    Assert.assertFalse(RuncContainerRuntime
        .isRuncContainerRequested(conf, null));
    Assert.assertTrue(RuncContainerRuntime
        .isRuncContainerRequested(conf, envRuncType));
    Assert.assertFalse(RuncContainerRuntime
        .isRuncContainerRequested(conf, envOtherType));
  }