maytasm3 commented on a change in pull request #9492: add manual laning
strategy, integration test
URL: https://github.com/apache/druid/pull/9492#discussion_r391201920
##########
File path:
integration-tests/src/test/java/org/apache/druid/tests/query/ITWikipediaQueryTest.java
##########
@@ -51,15 +69,78 @@ public void before() throws Exception
ITRetryUtil.retryUntilTrue(
() -> coordinatorClient.areSegmentsLoaded(WIKIPEDIA_DATA_SOURCE),
"wikipedia segment load"
);
- coordinatorClient.initializeLookups(WIKIPEDIA_LOOKUP_RESOURCE);
- ITRetryUtil.retryUntilTrue(
- () -> coordinatorClient.areLookupsLoaded(WIKI_LOOKUP), "wikipedia
lookup load"
- );
+ if (!coordinatorClient.areLookupsLoaded(WIKI_LOOKUP)) {
+ coordinatorClient.initializeLookups(WIKIPEDIA_LOOKUP_RESOURCE);
+ ITRetryUtil.retryUntilTrue(
+ () -> coordinatorClient.areLookupsLoaded(WIKI_LOOKUP), "wikipedia
lookup load"
+ );
+ }
}
@Test
public void testWikipediaQueriesFromFile() throws Exception
{
queryHelper.testQueriesFromFile(WIKIPEDIA_QUERIES_RESOURCE, 2);
}
+
+ @Test
+ public void testQueryLaning() throws Exception
+ {
+ // the broker is configured with 2 manually defined query lanes, 'one'
with limit 1, and 'two' with limit 'two'
+ // -Ddruid.query.scheduler.laning.type=manual
+ // -Ddruid.query.scheduler.laning.lanes.one=1
+ // -Ddruid.query.scheduler.laning.lanes.two=2
+ // by issuing 50 queries, at least 1 of them will succeed on 'one', and at
least 1 of them will overlap enough to
+ // get limited
+ final int numQueries = 50;
+ List<Future<StatusResponseHolder>> futures = new ArrayList<>(numQueries);
+ for (int i = 0; i < numQueries; i++) {
+ futures.add(
+ queryClient.queryAsync(
+ queryHelper.getQueryURL(config.getBrokerUrl()),
+ getQueryBuilder().build()
+ )
+ );
+ }
+
+ int success = 0;
+ int limited = 0;
+
+ for (Future<StatusResponseHolder> future : futures) {
+ StatusResponseHolder status = future.get();
+ if (status.getStatus().getCode() ==
QueryCapacityExceededException.STATUS_CODE) {
+ limited++;
+ Assert.assertTrue(status.getContent().contains("one"));
+ } else if (status.getStatus().getCode() ==
HttpResponseStatus.OK.getCode()) {
+ success++;
+ }
+ }
+
+ Assert.assertTrue(success > 0);
+ Assert.assertTrue(limited > 0);
+
+ // test another to make sure we can still issue one query at a time
Review comment:
This can be separate into another @test method. Will make understanding each
test case easier.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]