use of org.apache.druid.server.coordinator.CostBalancerStrategy in project druid by druid-io.
the class CachingCostBalancerStrategyTest method decisionTest.
@Test
public void decisionTest() {
CachingCostBalancerStrategy cachingCostBalancerStrategy = createCachingCostBalancerStrategy(serverHolderList, executorService);
CostBalancerStrategy costBalancerStrategy = createCostBalancerStrategy(executorService);
int notEqual = segmentQueries.stream().mapToInt(s -> {
ServerHolder s1 = cachingCostBalancerStrategy.findNewSegmentHomeBalancer(s, serverHolderList);
ServerHolder s2 = costBalancerStrategy.findNewSegmentHomeBalancer(s, serverHolderList);
return (s1.getServer().getName().equals(s2.getServer().getName())) ? 0 : 1;
}).sum();
Assert.assertTrue(((double) notEqual / (double) segmentQueries.size()) < 0.01);
}
Aggregations