maytasm3 commented on a change in pull request #9492: add manual laning
strategy, integration test
URL: https://github.com/apache/druid/pull/9492#discussion_r391206975
##########
File path: server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java
##########
@@ -399,6 +399,49 @@ public void testMisConfigHiLo()
}
+ @Test
+ public void testConfigManual()
+ {
+ final Injector injector = createInjector();
+ final String propertyPrefix = "druid.query.scheduler";
+ final JsonConfigProvider<QuerySchedulerProvider> provider =
JsonConfigProvider.of(
+ propertyPrefix,
+ QuerySchedulerProvider.class
+ );
+ final Properties properties = new Properties();
+ properties.put(propertyPrefix + ".numThreads", "10");
+ properties.put(propertyPrefix + ".laning.strategy", "manual");
+ properties.put(propertyPrefix + ".laning.lanes.one", "1");
+ properties.put(propertyPrefix + ".laning.lanes.two", "2");
+ provider.inject(properties, injector.getInstance(JsonConfigurator.class));
+ final QueryScheduler scheduler = provider.get().get().get();
+ Assert.assertEquals(10, scheduler.getTotalAvailableCapacity());
+ Assert.assertEquals(1, scheduler.getLaneAvailableCapacity("one"));
+ Assert.assertEquals(2, scheduler.getLaneAvailableCapacity("two"));
+ }
+
+ @Test
+ public void testConfigManualPercent()
+ {
+ final Injector injector = createInjector();
+ final String propertyPrefix = "druid.query.scheduler";
+ final JsonConfigProvider<QuerySchedulerProvider> provider =
JsonConfigProvider.of(
+ propertyPrefix,
+ QuerySchedulerProvider.class
+ );
+ final Properties properties = new Properties();
+ properties.put(propertyPrefix + ".numThreads", "10");
+ properties.put(propertyPrefix + ".laning.strategy", "manual");
+ properties.put(propertyPrefix + ".laning.isLimitPercent", "true");
+ properties.put(propertyPrefix + ".laning.lanes.one", "1");
+ properties.put(propertyPrefix + ".laning.lanes.twenty", "20");
+ provider.inject(properties, injector.getInstance(JsonConfigurator.class));
+ final QueryScheduler scheduler = provider.get().get().get();
+ Assert.assertEquals(10, scheduler.getTotalAvailableCapacity());
+ Assert.assertEquals(1, scheduler.getLaneAvailableCapacity("one"));
+ Assert.assertEquals(2, scheduler.getLaneAvailableCapacity("twenty"));
Review comment:
maybe also test negative case (like lane name "three") and see we get
NO_CAPACITY?
----------------------------------------------------------------
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]