use of com.netflix.titus.api.jobmanager.JobAttributes.JOB_ATTRIBUTES_RUNTIME_PREDICTION_AVAILABLE in project titus-control-plane by Netflix.
the class JobRuntimePredictionSanitizerTest method emptyPredictionsCauseSanitizationToBeSkipped.
@Test
public void emptyPredictionsCauseSanitizationToBeSkipped() {
JobDescriptor<BatchJobExt> noRuntimeLimit = jobDescriptor.but(jd -> jd.getExtensions().toBuilder().withRuntimeLimitMs(0));
JobRuntimePredictionClient client = mock(JobRuntimePredictionClient.class);
JobRuntimePredictions predictions = new JobRuntimePredictions("v1", modelId, new TreeSet<>());
when(client.getRuntimePredictions(any())).thenReturn(Mono.just(predictions));
AdmissionSanitizer<JobDescriptor> sanitizer = new JobRuntimePredictionSanitizer(client, JobRuntimePredictionSelectors.best(), config, TitusRuntimes.test());
StepVerifier.create(sanitizer.sanitizeAndApply(noRuntimeLimit)).assertNext(result -> assertThat(((JobDescriptor<?>) result).getAttributes()).containsEntry(JOB_ATTRIBUTES_SANITIZATION_SKIPPED_RUNTIME_PREDICTION, "true").containsEntry(JOB_ATTRIBUTES_RUNTIME_PREDICTION_MODEL_ID, modelId).containsEntry(JOB_ATTRIBUTES_RUNTIME_PREDICTION_VERSION, "v1").doesNotContainKeys(JOB_ATTRIBUTES_RUNTIME_PREDICTION_SEC, JOB_ATTRIBUTES_RUNTIME_PREDICTION_CONFIDENCE, JOB_ATTRIBUTES_RUNTIME_PREDICTION_AVAILABLE)).verifyComplete();
}
Aggregations