use of com.hubspot.singularity.api.SingularityPauseRequest in project Singularity by HubSpot.
the class SingularitySchedulerTest method testCleanerLeavesPausedRequestTasksByDemand.
@Test
public void testCleanerLeavesPausedRequestTasksByDemand() {
initScheduledRequest();
initFirstDeploy();
SingularityTask firstTask = launchTask(request, firstDeploy, 1, TaskState.TASK_RUNNING);
createAndSchedulePendingTask(firstDeployId);
requestResource.pause(requestId, Optional.of(new SingularityPauseRequest(Optional.of(false), Optional.absent(), Optional.absent(), Optional.absent(), Optional.absent())), singularityUser);
cleaner.drainCleanupQueue();
Assert.assertTrue(taskManager.getKilledTaskIdRecords().isEmpty());
Assert.assertTrue(taskManager.getPendingTaskIds().isEmpty());
Assert.assertTrue(requestManager.getCleanupRequests().isEmpty());
statusUpdate(firstTask, TaskState.TASK_FINISHED);
// make sure something new isn't scheduled!
Assert.assertTrue(taskManager.getPendingTaskIds().isEmpty());
}
use of com.hubspot.singularity.api.SingularityPauseRequest in project Singularity by HubSpot.
the class SingularityExpiringActionsTest method testExpiringPause.
@Test
public void testExpiringPause() {
initRequest();
initFirstDeploy();
SingularityTask taskOne = startTask(firstDeploy);
requestResource.pause(requestId, Optional.of(new SingularityPauseRequest(Optional.absent(), Optional.of(1L), Optional.absent(), Optional.absent(), Optional.absent())), singularityUser);
cleaner.drainCleanupQueue();
Assert.assertEquals(1, taskManager.getKilledTaskIdRecords().size());
statusUpdate(taskOne, TaskState.TASK_KILLED);
resourceOffers();
Assert.assertEquals(0, taskManager.getActiveTaskIds().size());
Assert.assertEquals(0, taskManager.getPendingTasks().size());
Assert.assertEquals(RequestState.PAUSED, requestManager.getRequest(requestId).get().getState());
Assert.assertEquals(requestId, requestManager.getPausedRequests(false).iterator().next().getRequest().getId());
try {
Thread.sleep(2);
} catch (InterruptedException ie) {
}
expiringUserActionPoller.runActionOnPoll();
resourceOffers();
Assert.assertEquals(1, taskManager.getActiveTaskIds().size());
Assert.assertEquals(0, taskManager.getPendingTasks().size());
Assert.assertEquals(RequestState.ACTIVE, requestManager.getRequest(requestId).get().getState());
Assert.assertEquals(requestId, requestManager.getActiveRequests(false).iterator().next().getRequest().getId());
}
Aggregations