use of io.fabric8.kubernetes.api.model.ContainerStateTerminated in project styx by spotify.
the class KubernetesDockerRunnerTest method shouldForceCleanupPodAfterPodForceDeletionTolerationPassed.
@Parameters({ "TERMINATED", "FAILED", "ERROR", "DONE" })
@Test
public void shouldForceCleanupPodAfterPodForceDeletionTolerationPassed(String stateName) {
final State state = State.valueOf(stateName);
// inject mock status in real instance
createdPod.setStatus(podStatus);
when(podStatus.getContainerStatuses()).thenReturn(List.of(keepaliveContainerStatus, containerStatus));
when(containerStatus.getName()).thenReturn(MAIN_CONTAINER_NAME);
when(containerStatus.getState()).thenReturn(containerState);
when(containerState.getTerminated()).thenReturn(containerStateTerminated);
when(containerStateTerminated.getFinishedAt()).thenReturn(FIXED_INSTANT.minus(Duration.ofMinutes(35)).toString());
var runState = RunState.create(WORKFLOW_INSTANCE, state);
var shouldDelete = kdr.shouldDeletePodWithRunState(WORKFLOW_INSTANCE, createdPod, runState);
assertThat(shouldDelete, is(PodDeletionDecision.FORCE_DELETE));
}
Aggregations