use of com.netflix.titus.grpc.protogen.Image in project titus-control-plane by Netflix.
the class JobSubmitAndControlNegativeTest method testJobWithInvalidNameAndTag.
@Test(timeout = TEST_TIMEOUT_MS)
public void testJobWithInvalidNameAndTag() {
Image badImage = Image.newBuilder().setName("????????").setTag("############").build();
submitBadJob(client, BATCH_JOB_DESCR_BUILDER.setContainer(BATCH_JOB_DESCR_BUILDER.getContainer().toBuilder().setImage(badImage)).build(), "container.image.name", "container.image.noValidImageDigestOrTag");
}
use of com.netflix.titus.grpc.protogen.Image in project titus-control-plane by Netflix.
the class ProtobufMessageObjectMapperTest method testMessageSerialization.
@Test
public void testMessageSerialization() throws Exception {
Image image = getImage();
ObjectMapper objectMapper = getObjectMapper();
String jsonString = objectMapper.writeValueAsString(image);
String expectedJsonString = JsonFormat.printer().includingDefaultValueFields().print(image);
Assertions.assertThat(jsonString).isEqualTo(expectedJsonString);
}
use of com.netflix.titus.grpc.protogen.Image in project titus-control-plane by Netflix.
the class ProtobufMessageObjectMapperTest method testMessageDeserialization.
@Test
public void testMessageDeserialization() throws Exception {
Image expectedImage = getImage();
String jsonString = JsonFormat.printer().includingDefaultValueFields().print(expectedImage);
ObjectMapper objectMapper = getObjectMapper();
Image image = objectMapper.readValue(jsonString, Image.class);
Assertions.assertThat(image).isEqualTo(expectedImage);
}
use of com.netflix.titus.grpc.protogen.Image in project titus-control-plane by Netflix.
the class JobObserveTest method observeByJobDescriptor.
@Test(timeout = LONG_TEST_TIMEOUT_MS)
public void observeByJobDescriptor() throws InterruptedException {
startAll(batchJobDescriptors().getValue().toBuilder().withApplicationName("myApp").build(), batchJobDescriptors().getValue().toBuilder().withApplicationName("otherApp").withOwner(Owner.newBuilder().withTeamEmail("me@netflix.com").build()).build(), batchJobDescriptors().getValue().but(j -> j.getContainer().toBuilder().withImage(JobModel.newImage().withName("some/image").withTag("stable").build())), batchJobDescriptors().getValue().toBuilder().withAttributes(ImmutableMap.<String, String>builder().put("attr1", "value1").put("attr2", "value2").build()).build());
startAll(serviceJobDescriptors().getValue());
observeByJobDescriptor(jobsScenarioBuilder.takeJobId(0), ObserveJobsQuery.newBuilder().putFilteringCriteria("applicationName", "myApp").build(), job -> assertThat(job.getJobDescriptor().getApplicationName()).isEqualTo("myApp"));
observeByJobDescriptor(jobsScenarioBuilder.takeJobId(1), ObserveJobsQuery.newBuilder().putFilteringCriteria("owner", "me@netflix.com").build(), job -> assertThat(job.getJobDescriptor().getOwner().getTeamEmail()).isEqualTo("me@netflix.com"));
observeByJobDescriptor(jobsScenarioBuilder.takeJobId(2), ObserveJobsQuery.newBuilder().putFilteringCriteria("imageName", "some/image").putFilteringCriteria("imageTag", "stable").build(), job -> {
Image image = job.getJobDescriptor().getContainer().getImage();
assertThat(image.getName()).isEqualTo("some/image");
assertThat(image.getTag()).isEqualTo("stable");
});
observeByJobDescriptor(jobsScenarioBuilder.takeJobId(3), ObserveJobsQuery.newBuilder().putFilteringCriteria("attributes", "attr1,attr2:value2").putFilteringCriteria("attributes.op", "and").build(), job -> assertThat(job.getJobDescriptor().getAttributesMap()).containsKey("attr1").containsEntry("attr2", "value2"));
observeByJobDescriptor(jobsScenarioBuilder.takeJobId(4), ObserveJobsQuery.newBuilder().putFilteringCriteria("jobType", "service").build(), job -> assertThat(job.getJobDescriptor().getJobSpecCase()).isEqualTo(SERVICE));
}
Aggregations