Search in sources :

Example 1 with TaskRelocationStatus

use of com.netflix.titus.grpc.protogen.TaskRelocationStatus in project titus-control-plane by Netflix.

the class TaskRelocationIntegrationTest method testPlannedRelocation.

@Test(timeout = 60_000)
public void testPlannedRelocation() throws Exception {
    Task task = createAndPlaceOneTaskJob(TestDataFactory.REMOVABLE_INSTANCE_GROUP_ID);
    relocationConnectorStubs.setQuota(task.getJobId(), 1);
    // Get the plan
    TaskRelocationPlan plan = doTry(() -> findRelocationPlan(task.getId()));
    assertThat(plan.getTaskId()).isEqualTo(task.getId());
    assertThat(plan.getReasonCode()).isEqualTo(TaskRelocationReason.SelfManagedMigration.name());
    assertThat(plan.getRelocationTime()).isLessThanOrEqualTo(clock.wallTime() + RELOCATION_TIME_MS);
    // Wait for the relocation
    TaskRelocationStatus status = doTry(() -> findRelocationStatus(task.getId()));
    assertThat(status.getState()).isEqualTo(TaskRelocationStatus.TaskRelocationState.Success);
    assertThat(status.getStatusCode()).isEqualTo(com.netflix.titus.api.relocation.model.TaskRelocationStatus.STATUS_CODE_TERMINATED);
    assertThat(status.getStatusMessage()).isNotEmpty();
}
Also used : Task(com.netflix.titus.api.jobmanager.model.job.Task) TaskRelocationStatus(com.netflix.titus.grpc.protogen.TaskRelocationStatus) TaskRelocationPlan(com.netflix.titus.grpc.protogen.TaskRelocationPlan) IntegrationTest(com.netflix.titus.testkit.junit.category.IntegrationTest) Test(org.junit.Test)

Aggregations

Task (com.netflix.titus.api.jobmanager.model.job.Task)1 TaskRelocationPlan (com.netflix.titus.grpc.protogen.TaskRelocationPlan)1 TaskRelocationStatus (com.netflix.titus.grpc.protogen.TaskRelocationStatus)1 IntegrationTest (com.netflix.titus.testkit.junit.category.IntegrationTest)1 Test (org.junit.Test)1