Skip to content

Commit

Permalink
fix: address some comments
Browse files Browse the repository at this point in the history
Signed-off-by: Zhangjian He <[email protected]>
  • Loading branch information
hezhangjian committed Jan 13, 2025
1 parent c5a593c commit ff2eddd
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff2eddd

Please sign in to comment.