"druid.request.logging.type" should allow "noop" value (#10774)

This commit is contained in:
Junegunn Choi 2021-07-21 01:10:46 +09:00 committed by GitHub
parent c7fdf1d685
commit 69b0c6a47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,7 @@ public class QueryableModule implements DruidModule
return Collections.singletonList(
new SimpleModule("QueryableModule")
.registerSubtypes(
NoopRequestLoggerProvider.class,
EmittingRequestLoggerProvider.class,
FileRequestLoggerProvider.class,
LoggingRequestLoggerProvider.class,

View File

@ -31,6 +31,7 @@ import org.apache.druid.guice.JsonConfigurator;
import org.apache.druid.guice.ManageLifecycle;
import org.apache.druid.guice.QueryableModule;
import org.apache.druid.initialization.Initialization;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
@ -70,6 +71,15 @@ public class LoggingRequestLoggerProviderTest
Assert.assertTrue(requestLogger.isSetMDC());
}
@Test
public void testNoopConfigParsing()
{
final Properties properties = new Properties();
properties.put(propertyPrefix + ".type", "noop");
provider.inject(properties, injector.getInstance(JsonConfigurator.class));
Assert.assertThat(provider.get().get().get(), Matchers.instanceOf(NoopRequestLogger.class));
}
private Injector makeInjector()
{
return Initialization.makeInjectorWithModules(