diff --git a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java index 229163d7006..2bff8278d07 100644 --- a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java +++ b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java @@ -82,7 +82,42 @@ public void testLoadFeaturesFromBase() throws Exception { @FlakyTest("https://issues.apache.org/jira/browse/DL-40") public void testLoadFeaturesFromOverlay() throws Exception { - Assertions.fail("xxx"); + PropertiesWriter writer = new PropertiesWriter(); + writer.setProperty("feature_1", "10000"); + writer.setProperty("feature_2", "5000"); + writer.save(); + + PropertiesWriter overlayWriter = new PropertiesWriter(); + overlayWriter.setProperty("feature_2", "6000"); + overlayWriter.setProperty("feature_4", "6000"); + overlayWriter.save(); + + DistributedLogConfiguration conf = new DistributedLogConfiguration() + .setDynamicConfigReloadIntervalSec(Integer.MAX_VALUE) + .setFileFeatureProviderBaseConfigPath(writer.getFile().toURI().toURL().getPath()) + .setFileFeatureProviderOverlayConfigPath(overlayWriter.getFile().toURI().toURL().getPath()); + DynamicConfigurationFeatureProvider provider = + new DynamicConfigurationFeatureProvider("", conf, NullStatsLogger.INSTANCE); + provider.start(); + ensureConfigReloaded(); + + Feature feature1 = provider.getFeature("feature_1"); + assertTrue(feature1.isAvailable()); + assertEquals(10000, feature1.availability()); + Feature feature2 = provider.getFeature("feature_2"); + assertTrue(feature2.isAvailable()); + assertEquals(6000, feature2.availability()); + Feature feature3 = provider.getFeature("feature_3"); + assertFalse(feature3.isAvailable()); + assertEquals(0, feature3.availability()); + Feature feature4 = provider.getFeature("feature_4"); + assertTrue(feature4.isAvailable()); + assertEquals(6000, feature4.availability()); + Feature feature5 = provider.getFeature("unknown_feature"); + assertFalse(feature5.isAvailable()); + assertEquals(0, feature5.availability()); + + provider.stop(); } @Test