Search in sources :

Example 6 with TestDruidCoordinatorConfig

use of org.apache.druid.server.coordinator.TestDruidCoordinatorConfig in project druid by druid-io.

the class KillSupervisorsTest method testConstructorFailIfInvalidRetainDuration.

@Test
public void testConstructorFailIfInvalidRetainDuration() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, new Duration("PT6S"), new Duration("PT-1S"), null, null, null, null, null, null, null, 10, null);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Coordinator supervisor kill retainDuration must be >= 0");
    killSupervisors = new KillSupervisors(druidCoordinatorConfig, mockMetadataSupervisorManager);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 7 with TestDruidCoordinatorConfig

use of org.apache.druid.server.coordinator.TestDruidCoordinatorConfig in project druid by druid-io.

the class KillSupervisorsTest method testConstructorFailIfInvalidPeriod.

@Test
public void testConstructorFailIfInvalidPeriod() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, new Duration("PT3S"), new Duration("PT1S"), null, null, null, null, null, null, null, 10, null);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Coordinator supervisor kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod");
    killSupervisors = new KillSupervisors(druidCoordinatorConfig, mockMetadataSupervisorManager);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 8 with TestDruidCoordinatorConfig

use of org.apache.druid.server.coordinator.TestDruidCoordinatorConfig in project druid by druid-io.

the class KillDatasourceMetadataTest method testConstructorFailIfInvalidRetainDuration.

@Test
public void testConstructorFailIfInvalidRetainDuration() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, null, null, null, new Duration("PT6S"), new Duration("PT-1S"), 10, null);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Coordinator datasource metadata kill retainDuration must be >= 0");
    killDatasourceMetadata = new KillDatasourceMetadata(druidCoordinatorConfig, mockIndexerMetadataStorageCoordinator, mockMetadataSupervisorManager);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 9 with TestDruidCoordinatorConfig

use of org.apache.druid.server.coordinator.TestDruidCoordinatorConfig in project druid by druid-io.

the class KillDatasourceMetadataTest method testConstructorFailIfInvalidPeriod.

@Test
public void testConstructorFailIfInvalidPeriod() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, null, null, null, new Duration("PT3S"), new Duration("PT1S"), 10, null);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Coordinator datasource metadata kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod");
    killDatasourceMetadata = new KillDatasourceMetadata(druidCoordinatorConfig, mockIndexerMetadataStorageCoordinator, mockMetadataSupervisorManager);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 10 with TestDruidCoordinatorConfig

use of org.apache.druid.server.coordinator.TestDruidCoordinatorConfig in project druid by druid-io.

the class KillDatasourceMetadataTest method testRunNotSkipIfLastRunMoreThanPeriod.

@Test
public void testRunNotSkipIfLastRunMoreThanPeriod() {
    Mockito.when(mockDruidCoordinatorRuntimeParams.getEmitter()).thenReturn(mockServiceEmitter);
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, null, null, null, new Duration("PT6S"), new Duration("PT1S"), 10, null);
    killDatasourceMetadata = new KillDatasourceMetadata(druidCoordinatorConfig, mockIndexerMetadataStorageCoordinator, mockMetadataSupervisorManager);
    killDatasourceMetadata.run(mockDruidCoordinatorRuntimeParams);
    Mockito.verify(mockIndexerMetadataStorageCoordinator).removeDataSourceMetadataOlderThan(ArgumentMatchers.anyLong(), ArgumentMatchers.anySet());
    Mockito.verify(mockServiceEmitter).emit(ArgumentMatchers.any(ServiceEventBuilder.class));
}
Also used : ServiceEventBuilder(org.apache.druid.java.util.emitter.service.ServiceEventBuilder) TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Aggregations

TestDruidCoordinatorConfig (org.apache.druid.server.coordinator.TestDruidCoordinatorConfig)22 Duration (org.joda.time.Duration)22 Test (org.junit.Test)22 ServiceEventBuilder (org.apache.druid.java.util.emitter.service.ServiceEventBuilder)8 CoordinatorCompactionConfig (org.apache.druid.server.coordinator.CoordinatorCompactionConfig)3 DataSourceCompactionConfig (org.apache.druid.server.coordinator.DataSourceCompactionConfig)2 UserCompactionTaskGranularityConfig (org.apache.druid.server.coordinator.UserCompactionTaskGranularityConfig)2 Period (org.joda.time.Period)2 ExpectedException (org.junit.rules.ExpectedException)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Answer (org.mockito.stubbing.Answer)1