use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.
the class FillCapacityWithAffinityWorkerSelectStrategyTest method testIsolation.
@Test
public void testIsolation() throws Exception {
FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null));
Assert.assertFalse(optional.isPresent());
}
use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.
the class FillCapacityWithAffinityWorkerSelectStrategyTest method testFindWorkerForTask.
@Test
public void testFindWorkerForTask() throws Exception {
FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("lhost", new ImmutableWorkerInfo(new Worker("lhost", "lhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now()), "localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null) {
@Override
public String getDataSource() {
return "foo";
}
});
ImmutableWorkerInfo worker = optional.get();
Assert.assertEquals("localhost", worker.getWorker().getHost());
}
use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.
the class FillCapacityWithAffinityWorkerSelectStrategyTest method testFindWorkerForTaskWithNulls.
@Test
public void testFindWorkerForTaskWithNulls() throws Exception {
FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("lhost", new ImmutableWorkerInfo(new Worker("lhost", "lhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now()), "localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null));
ImmutableWorkerInfo worker = optional.get();
Assert.assertEquals("lhost", worker.getWorker().getHost());
}
use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.
the class SegmentAllocateActionTest method testCannotAddToExistingSingleDimensionShardSpecs.
@Test
public void testCannotAddToExistingSingleDimensionShardSpecs() throws Exception {
final Task task = new NoopTask(null, 0, 0, null, null, null);
taskActionTestKit.getMetadataStorageCoordinator().announceHistoricalSegments(ImmutableSet.of(DataSegment.builder().dataSource(DATA_SOURCE).interval(Granularities.HOUR.bucket(PARTY_TIME)).version(PARTY_TIME.toString()).shardSpec(new SingleDimensionShardSpec("foo", null, "bar", 0)).build(), DataSegment.builder().dataSource(DATA_SOURCE).interval(Granularities.HOUR.bucket(PARTY_TIME)).version(PARTY_TIME.toString()).shardSpec(new SingleDimensionShardSpec("foo", "bar", null, 1)).build()));
taskActionTestKit.getTaskLockbox().add(task);
final SegmentIdentifier id1 = allocate(task, PARTY_TIME, Granularities.NONE, Granularities.HOUR, "s1", null);
Assert.assertNull(id1);
}
use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.
the class SegmentAllocateActionTest method testCannotDoAnythingWithSillyQueryGranularity.
@Test
public void testCannotDoAnythingWithSillyQueryGranularity() throws Exception {
final Task task = new NoopTask(null, 0, 0, null, null, null);
taskActionTestKit.getTaskLockbox().add(task);
final SegmentIdentifier id1 = allocate(task, PARTY_TIME, Granularities.DAY, Granularities.HOUR, "s1", null);
Assert.assertNull(id1);
}
Aggregations