use of com.hubspot.singularity.api.SingularitySkipHealthchecksRequest in project Singularity by HubSpot.
the class SingularityHealthchecksTest method testSkipHealthchecksEdgeCases.
@Test
public void testSkipHealthchecksEdgeCases() {
try {
setConfigurationForNoDelay();
configuration.setKillAfterTasksDoNotRunDefaultSeconds(100);
configuration.setCheckNewTasksEverySeconds(1);
initRequest();
initHCDeploy();
requestResource.skipHealthchecks(requestId, new SingularitySkipHealthchecksRequest(Optional.of(Boolean.TRUE), Optional.absent(), Optional.absent(), Optional.absent()), singularityUser);
SingularityTask firstTask = startTask(firstDeploy, 1);
Assert.assertTrue(!taskManager.getLastHealthcheck(firstTask.getTaskId()).isPresent());
finishHealthchecks();
finishNewTaskChecksAndCleanup();
Assert.assertEquals(1, taskManager.getNumActiveTasks());
requestResource.skipHealthchecks(requestId, new SingularitySkipHealthchecksRequest(Optional.of(Boolean.FALSE), Optional.absent(), Optional.absent(), Optional.absent()), singularityUser);
// run new task check ONLY.
newTaskChecker.enqueueNewTaskCheck(firstTask, requestManager.getRequest(requestId), healthchecker);
finishNewTaskChecks();
finishHealthchecks();
finishNewTaskChecksAndCleanup();
// healthcheck will fail
Assert.assertTrue(taskManager.getLastHealthcheck(firstTask.getTaskId()).isPresent());
Assert.assertEquals(0, taskManager.getNumActiveTasks());
} finally {
unsetConfigurationForNoDelay();
configuration.setCheckNewTasksEverySeconds(5);
}
}
use of com.hubspot.singularity.api.SingularitySkipHealthchecksRequest in project Singularity by HubSpot.
the class SingularityExpiringActionsTest method testExpiringSkipHealthchecks.
@Test
public void testExpiringSkipHealthchecks() {
initRequest();
initHCDeploy();
SingularityTask firstTask = startTask(firstDeploy);
Assert.assertTrue(healthchecker.cancelHealthcheck(firstTask.getTaskId().getId()));
requestResource.skipHealthchecks(requestId, new SingularitySkipHealthchecksRequest(Optional.of(true), Optional.of(1L), Optional.absent(), Optional.absent()), singularityUser);
statusUpdate(firstTask, TaskState.TASK_FAILED);
SingularityTask secondTask = startTask(firstDeploy);
Assert.assertFalse(healthchecker.cancelHealthcheck(secondTask.getTaskId().getId()));
statusUpdate(secondTask, TaskState.TASK_FAILED);
expiringUserActionPoller.runActionOnPoll();
SingularityTask thirdTask = startTask(firstDeploy);
Assert.assertTrue(healthchecker.cancelHealthcheck(thirdTask.getTaskId().getId()));
}
Aggregations