use of io.druid.indexing.overlord.config.RemoteTaskRunnerConfig in project druid by druid-io.
the class PendingTaskBasedResourceManagementStrategyTest method testSuccessfulMinWorkersProvisionWithOldVersionNodeRunning.
@Test
public void testSuccessfulMinWorkersProvisionWithOldVersionNodeRunning() throws Exception {
EasyMock.expect(autoScaler.getMinNumWorkers()).andReturn(3);
EasyMock.expect(autoScaler.getMaxNumWorkers()).andReturn(5);
EasyMock.expect(autoScaler.ipToIdLookup(EasyMock.<List<String>>anyObject())).andReturn(Lists.<String>newArrayList());
RemoteTaskRunner runner = EasyMock.createMock(RemoteTaskRunner.class);
// No pending tasks
EasyMock.expect(runner.getPendingTaskPayloads()).andReturn(Lists.<Task>newArrayList());
// 1 node already running, only provision 2 more.
EasyMock.expect(runner.getWorkers()).andReturn(Arrays.<ImmutableWorkerInfo>asList(new TestZkWorker(testTask).toImmutable(), // Invalid version node
new TestZkWorker(testTask, "h1", "n1", INVALID_VERSION).toImmutable()));
EasyMock.expect(runner.getConfig()).andReturn(new RemoteTaskRunnerConfig());
EasyMock.expect(autoScaler.provision()).andReturn(new AutoScalingData(Lists.<String>newArrayList("aNode"))).times(2);
EasyMock.replay(runner, autoScaler);
boolean provisionedSomething = strategy.doProvision(runner);
Assert.assertTrue(provisionedSomething);
Assert.assertTrue(strategy.getStats().toList().size() == 2);
for (ScalingStats.ScalingEvent event : strategy.getStats().toList()) {
Assert.assertTrue(event.getEvent() == ScalingStats.EVENT.PROVISION);
}
}
Aggregations