@Test
public void testContainerKill() throws Exception {

  if (!shouldRun()) {
    return;
  }
  
  final ContainerId sleepId = getNextContainerId();   
  Thread t = new Thread() {
    public void run() {
      try {
        runAndBlock(sleepId, "sleep", "100");
      } catch (IOException e) {
        LOG.warn("Caught exception while running sleep",e);
      }
    };
  };
  t.setDaemon(true); //If it does not exit we shouldn't block the test.
  t.start();
  assertTrue(t.isAlive());
 
  String pid = null;
  int count = 10;
  while ((pid = exec.getProcessId(sleepId)) == null && count > 0) {
    LOG.info("Sleeping for 200 ms before checking for pid ");
    Thread.sleep(200);
    count--;
  }
  assertNotNull(pid);
  LOG.info("Going to killing the process.");
  exec.signalContainer(appSubmitter, pid, Signal.TERM);
  LOG.info("sleeping for 100ms to let the sleep be killed");
  Thread.sleep(100);
  
  assertFalse(t.isAlive());
}