Search in sources :

Example 1 with EmittingLogger

use of org.apache.druid.java.util.emitter.EmittingLogger in project druid by druid-io.

the class PendingTaskBasedProvisioningStrategyTest method testFailIfMinWorkerIsZeroAndWorkerHintNotSet.

@Test
public void testFailIfMinWorkerIsZeroAndWorkerHintNotSet() {
    EmittingLogger mockLogger = EasyMock.createMock(EmittingLogger.class);
    Capture<String> capturedArgument = Capture.newInstance();
    mockLogger.error(EasyMock.capture(capturedArgument), EasyMock.anyInt());
    PendingTaskBasedWorkerProvisioningConfig config = new PendingTaskBasedWorkerProvisioningConfig().setMaxScalingDuration(new Period(1000)).setNumEventsToTrack(10).setPendingTaskTimeout(new Period(0)).setWorkerVersion(MIN_VERSION).setMaxScalingStep(2);
    EasyMock.expect(autoScaler.getMinNumWorkers()).andReturn(0);
    EasyMock.replay(autoScaler, mockLogger);
    DefaultWorkerBehaviorConfig defaultWorkerBehaviorConfig = PendingTaskBasedWorkerProvisioningStrategy.getDefaultWorkerBehaviorConfig(DSuppliers.of(workerConfig), config, "test", mockLogger);
    Assert.assertNull(defaultWorkerBehaviorConfig);
    Assert.assertEquals(PendingTaskBasedWorkerProvisioningStrategy.ERROR_MESSAGE_MIN_WORKER_ZERO_HINT_UNSET, capturedArgument.getValue());
}
Also used : EmittingLogger(org.apache.druid.java.util.emitter.EmittingLogger) DefaultWorkerBehaviorConfig(org.apache.druid.indexing.overlord.setup.DefaultWorkerBehaviorConfig) Period(org.joda.time.Period) Test(org.junit.Test)

Aggregations

DefaultWorkerBehaviorConfig (org.apache.druid.indexing.overlord.setup.DefaultWorkerBehaviorConfig)1 EmittingLogger (org.apache.druid.java.util.emitter.EmittingLogger)1 Period (org.joda.time.Period)1 Test (org.junit.Test)1