use of com.yelp.nrtsearch.server.grpc.ProfileResult in project nrtsearch by Yelp.
the class SearchStatsWrapperTest method testTerminateFlag.
@Test
public void testTerminateFlag() throws IOException {
SearchStatsWrapper searchStatsWrapper = new SearchStatsWrapper(new MockTerminateCollectorManager());
List<Collector> collectors = new ArrayList<>();
for (int i = 0; i < 3; ++i) {
Collector c = searchStatsWrapper.newCollector();
collectors.add(c);
try {
c.getLeafCollector(null);
assert false;
} catch (CollectionTerminatedException ignored) {
}
}
searchStatsWrapper.reduce(collectors);
ProfileResult.Builder builder = ProfileResult.newBuilder();
searchStatsWrapper.addProfiling(builder);
ProfileResult result = builder.build();
assertEquals(3, result.getSearchStats().getCollectorStatsCount());
for (CollectorStats collectorStats : result.getSearchStats().getCollectorStatsList()) {
assertTrue(collectorStats.getTerminated());
}
}
Aggregations