use of com.hubspot.singularity.api.SingularityScaleRequest in project Singularity by HubSpot.
the class SingularitySchedulerTest method testScaleWithBounceDoesNotLaunchExtraInstances.
@Test
public void testScaleWithBounceDoesNotLaunchExtraInstances() {
initRequest();
initFirstDeploy();
launchTask(request, firstDeploy, 1, TaskState.TASK_RUNNING);
requestResource.scale(requestId, new SingularityScaleRequest(Optional.of(5), Optional.of(1L), Optional.absent(), Optional.absent(), Optional.absent(), Optional.of(true), Optional.absent(), Optional.absent()), singularityUser);
Assert.assertEquals(1, requestManager.getCleanupRequests().size());
cleaner.drainCleanupQueue();
Assert.assertEquals(1, taskManager.getNumCleanupTasks());
scheduler.drainPendingQueue();
Assert.assertEquals(5, taskManager.getPendingTaskIds().size());
}
use of com.hubspot.singularity.api.SingularityScaleRequest in project Singularity by HubSpot.
the class SingularitySchedulerTest method testScaleDownTakesHighestInstances.
@Test
public void testScaleDownTakesHighestInstances() {
initRequest();
initFirstDeploy();
saveAndSchedule(request.toBuilder().setInstances(Optional.of(5)));
resourceOffers();
Assert.assertEquals(5, taskManager.getActiveTaskIds().size());
requestResource.scale(requestId, new SingularityScaleRequest(Optional.of(2), Optional.absent(), Optional.absent(), Optional.absent(), Optional.absent(), Optional.absent(), Optional.absent(), Optional.absent()), singularityUser);
resourceOffers();
cleaner.drainCleanupQueue();
Assert.assertEquals(3, taskManager.getKilledTaskIdRecords().size());
for (SingularityKilledTaskIdRecord taskId : taskManager.getKilledTaskIdRecords()) {
Assert.assertTrue(taskId.getTaskId().getInstanceNo() > 2);
scheduler.drainPendingQueue();
}
}
Aggregations