@Test
@DirtiesContext
public void backfillEventuallyDies() throws Exception {
Manager rm = this.locator.getManager();
Caller superuser = this.populator().getSuperuserCaller();
logger.info(rm.getVMMReport());
logger.debug("Submitting backfill request");
AsyncCreateRequest backfill1 = this.populator().getBackfillRequest("backfill1", 1);
RequestInfo backfill1Result = rm.addBackfillRequest(backfill1, superuser);
logger.debug("Waiting 2 seconds for resources to be allocated.");
Thread.sleep(2000);
// Check backfill request state
RequestInfo[] backfillRequestsByCaller = rm.getBackfillRequestsByCaller(superuser);
assertEquals(1, backfillRequestsByCaller.length);
logger.info(rm.getVMMReport());
// Set the shutdown task to not work
MockShutdownTrash.resetFailCount();
MockShutdownTrash.setFail(true);
logger.warn("Set to fail.");
// One regular VM that needs all the 512 RAM will preempt
Caller caller = this.populator().getCaller();
CreateRequest req = this.populator().getCreateRequest("regular", 1200, 512 , 1);
// In 10 seconds, trigger the shutdown task to start succeeding
this.suiteExecutor.submit(new DestroyEnableFutureTask(10));