Search in sources :

Example 16 with TestDruidCoordinatorConfig

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

the class KillCompactionConfigTest method testConstructorFailIfInvalidPeriod.

@Test
public void testConstructorFailIfInvalidPeriod() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, new Duration("PT3S"), null, null, null, null, 10, null);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Coordinator compaction configuration kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod");
    killCompactionConfig = new KillCompactionConfig(druidCoordinatorConfig, mockSqlSegmentsMetadataManager, mockJacksonConfigManager, mockConnector, mockConnectorConfig);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 17 with TestDruidCoordinatorConfig

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

the class KillCompactionConfigTest method testRunSkipIfLastRunLessThanPeriod.

@Test
public void testRunSkipIfLastRunLessThanPeriod() {
    TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, new Duration(Long.MAX_VALUE), null, null, null, null, 10, null);
    killCompactionConfig = new KillCompactionConfig(druidCoordinatorConfig, mockSqlSegmentsMetadataManager, mockJacksonConfigManager, mockConnector, mockConnectorConfig);
    killCompactionConfig.run(mockDruidCoordinatorRuntimeParams);
    Mockito.verifyNoInteractions(mockSqlSegmentsMetadataManager);
    Mockito.verifyNoInteractions(mockJacksonConfigManager);
    Mockito.verifyNoInteractions(mockServiceEmitter);
}
Also used : TestDruidCoordinatorConfig(org.apache.druid.server.coordinator.TestDruidCoordinatorConfig) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 18 with TestDruidCoordinatorConfig

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

the class KillRulesTest 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, new Duration("PT6S"), new Duration("PT1S"), null, null, 10, null);
    killRules = new KillRules(druidCoordinatorConfig);
    killRules.run(mockDruidCoordinatorRuntimeParams);
    Mockito.verify(mockRuleManager).removeRulesForEmptyDatasourcesOlderThan(ArgumentMatchers.anyLong());
    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)

Example 19 with TestDruidCoordinatorConfig

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

the class KillRulesTest method testConstructorFailIfInvalidRetainDuration.

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

Example 20 with TestDruidCoordinatorConfig

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

the class KillAuditLogTest 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, new Duration("PT6S"), new Duration("PT1S"), null, null, null, null, null, 10, null);
    killAuditLog = new KillAuditLog(mockAuditManager, druidCoordinatorConfig);
    killAuditLog.run(mockDruidCoordinatorRuntimeParams);
    Mockito.verify(mockAuditManager).removeAuditLogsOlderThan(ArgumentMatchers.anyLong());
    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