public void testPreemptWithOfferAndMultipleTasks() throws Exception {
schedulingFilter = new SchedulingFilterImpl(storageUtil.storage, maintenance);
setUpHost(HOST_A, RACK_A);
ScheduledTask a1 = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1");
a1.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
runOnHost(a1, HOST_A);
ScheduledTask a2 = makeTask(USER_A, JOB_B, TASK_ID_A + "_a2");
a2.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
runOnHost(a2, HOST_A);
Offer o1 = makeOffer(OFFER_A, HOST_A, 2, Amount.of(1024L, Data.MB), Amount.of(1L, Data.MB), 1);
expectOffers(o1);
ScheduledTask p1 = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
p1.getAssignedTask().getTask().setNumCpus(4).setRamMb(2048);
clock.advance(PREEMPTION_DELAY);
expectGetActiveTasks(a1, a2);
expectGetPendingTasks(p1);