use of com.netflix.titus.runtime.endpoint.v3.grpc.GrpcJobManagementModelConverters in project titus-control-plane by Netflix.
the class AggregatingJobServiceGatewayTest method findJobsEmptyPage.
@Test
public void findJobsEmptyPage() {
Random random = new Random();
final List<Job> cellOneSnapshot = new ArrayList<>();
final List<Job> cellTwoSnapshot = new ArrayList<>();
for (int i = 0; i < 5; i++) {
Iterables.addAll(cellOneSnapshot, Iterables.concat(dataGenerator.newBatchJobs(random.nextInt(10), GrpcJobManagementModelConverters::toGrpcJob), dataGenerator.newServiceJobs(random.nextInt(10), GrpcJobManagementModelConverters::toGrpcJob)));
Iterables.addAll(cellTwoSnapshot, Iterables.concat(dataGenerator.newBatchJobs(random.nextInt(10), GrpcJobManagementModelConverters::toGrpcJob), dataGenerator.newServiceJobs(random.nextInt(10), GrpcJobManagementModelConverters::toGrpcJob)));
clock.advanceTime(1, TimeUnit.MINUTES);
}
cellOne.getServiceRegistry().addService(new CellWithFixedJobsService(cellOneSnapshot, cellOneUpdates.serialize()));
cellTwo.getServiceRegistry().addService(new CellWithFixedJobsService(cellTwoSnapshot, cellTwoUpdates.serialize()));
JobQuery query = JobQuery.newBuilder().setPage(toGrpcPage(Page.empty())).build();
final AssertableSubscriber<JobQueryResult> testSubscriber = service.findJobs(query, UNDEFINED_CALL_METADATA).test();
testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
testSubscriber.assertNoErrors().assertCompleted();
testSubscriber.assertValueCount(1);
final List<JobQueryResult> results = testSubscriber.getOnNextEvents();
assertThat(results).hasSize(1);
assertThat(results.get(0).getItemsList()).isEmpty();
assertThat(results.get(0).getPagination().getHasMore()).isFalse();
}
Aggregations