@Override
  public boolean reapContainer(ContainerReapContext ctx) throws IOException {
    Container container = ctx.getContainer();
    String user = ctx.getUser();
    String runAsUser = getRunAsUser(user);
    ContainerRuntimeContext runtimeContext = new ContainerRuntimeContext
        .Builder(container)
        .setExecutionAttribute(RUN_AS_USER, runAsUser)
        .setExecutionAttribute(USER, user)
        .build();
    try {
      linuxContainerRuntime.reapContainer(runtimeContext);
    } catch (ContainerExecutionException e) {
      int retCode = e.getExitCode();
      if (retCode != 0) {
        return false;
      }
      LOG.warn("Error in reaping container {} exit = {}",
          container.getContainerId(), retCode, e);
      logOutput(e.getOutput());
      throw new IOException("Error in reaping container "
          + container.getContainerId().toString() + " exit = " + retCode, e);
    } finally {
      postComplete(container.getContainerId());
    }
    return true;
  }
@Test
  public void testReapContainer() throws Exception {
    Container container = mock(Container.class);
    LinuxContainerRuntime containerRuntime = mock(LinuxContainerRuntime.class);
    LinuxContainerExecutor lce = spy(new LinuxContainerExecutor(
        containerRuntime));
    ContainerReapContext.Builder builder =  new ContainerReapContext.Builder();
    builder.setContainer(container).setUser("foo");
    ContainerReapContext ctx = builder.build();
    lce.reapContainer(ctx);
    verify(lce, times(1)).reapContainer(ctx);
    verify(lce, times(1)).postComplete(any());
  }