use of com.hubspot.singularity.CrashLoopInfo in project Singularity by HubSpot.
the class SingularityCrashLoopTest method itDetectsTooManyOoms.
@Test
public void itDetectsTooManyOoms() {
initRequestWithType(RequestType.WORKER, false);
initFirstDeploy();
long now = System.currentTimeMillis();
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(1), TaskFailureType.OOM);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(11), TaskFailureType.OOM);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(16), TaskFailureType.OOM);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(20), TaskFailureType.OOM);
SingularityDeployStatistics deployStatistics = deployManager.getDeployStatistics(requestId, firstDeployId).get();
List<CrashLoopInfo> active = crashLoops.getActiveCrashLoops(deployStatistics);
Assertions.assertTrue(active.size() > 1);
Assertions.assertTrue(active.stream().map(CrashLoopInfo::getType).anyMatch(l -> l == CrashLoopType.OOM));
}
use of com.hubspot.singularity.CrashLoopInfo in project Singularity by HubSpot.
the class SingularityCrashLoopTest method itSavesSubsequentLoopsOfSameType.
@Test
public void itSavesSubsequentLoopsOfSameType() {
requestManager.saveCrashLoop(new CrashLoopInfo(requestId, firstDeployId, System.currentTimeMillis() - 60000, Optional.of(System.currentTimeMillis() - 30000), CrashLoopType.FAST_FAILURE_LOOP));
itDetectsFastFailureLoopsForNonLongRunning();
}
use of com.hubspot.singularity.CrashLoopInfo in project Singularity by HubSpot.
the class SingularityCrashLoopTest method itDoesNotTriggerSlowFailureLoopForFailuresConfinedToASmallTimeRange.
@Test
public void itDoesNotTriggerSlowFailureLoopForFailuresConfinedToASmallTimeRange() {
initRequestWithType(RequestType.WORKER, false);
initFirstDeploy();
long now = System.currentTimeMillis();
// Five minutes ago, should have already cleared
createTaskFailure(1, now - 1000 - 300000, TaskFailureType.BAD_EXIT_CODE);
createTaskFailure(1, now - 10000 - 300000, TaskFailureType.BAD_EXIT_CODE);
createTaskFailure(1, now - 20000 - 300000, TaskFailureType.BAD_EXIT_CODE);
createTaskFailure(1, now - 30000 - 300000, TaskFailureType.BAD_EXIT_CODE);
createTaskFailure(1, now - 45000 - 300000, TaskFailureType.BAD_EXIT_CODE);
SingularityDeployStatistics deployStatistics = deployManager.getDeployStatistics(requestId, firstDeployId).get();
List<CrashLoopInfo> active = crashLoops.getActiveCrashLoops(deployStatistics);
Assertions.assertEquals(0, active.size());
}
use of com.hubspot.singularity.CrashLoopInfo in project Singularity by HubSpot.
the class SingularityCrashLoopTest method itDetectsASingleInstanceFailureLoop.
@Test
public void itDetectsASingleInstanceFailureLoop() {
initRequestWithType(RequestType.WORKER, false);
initFirstDeploy();
long now = System.currentTimeMillis();
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(1), TaskFailureType.BAD_EXIT_CODE);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(6), TaskFailureType.OOM);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(11), TaskFailureType.OUT_OF_DISK_SPACE);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(16), TaskFailureType.OUT_OF_DISK_SPACE);
createTaskFailure(1, now - TimeUnit.MINUTES.toMillis(21), TaskFailureType.OOM);
SingularityDeployStatistics deployStatistics = deployManager.getDeployStatistics(requestId, firstDeployId).get();
List<CrashLoopInfo> active = crashLoops.getActiveCrashLoops(deployStatistics);
Assertions.assertEquals(1, active.size());
Assertions.assertEquals(CrashLoopType.SINGLE_INSTANCE_FAILURE_LOOP, Iterables.getOnlyElement(active).getType());
}
Aggregations