andrew4699 commented on code in PR #459:
URL: https://github.com/apache/polaris/pull/459#discussion_r1854305841


##########
polaris-service/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java:
##########
@@ -106,4 +111,77 @@ public void testGetRealmConfiguration() {
     String keyTwoRealm3 = 
defaultConfigurationStore.getConfiguration(realm3Ctx, "key2");
     assertThat(keyTwoRealm3).isEqualTo(defaultKeyTwoValue);
   }
+
+  @Test
+  public void testDynamicConfig() {
+    InMemoryPolarisMetaStoreManagerFactory metastoreFactory =
+        new InMemoryPolarisMetaStoreManagerFactory();
+    PolarisCallContext polarisCtx =
+        new PolarisCallContext(
+            metastoreFactory.getOrCreateSessionSupplier(() -> "realm1").get(),
+            new PolarisDefaultDiagServiceImpl());
+
+    String key = "k1";
+    Map<String, Object> staticConfig = Map.of(key, 10);
+
+    assertThat(
+            new DefaultConfigurationStore(staticConfig, Map.of(), k -> 
Optional.empty())
+                .<Integer>getConfiguration(polarisCtx, key))
+        .as("The DynamicFeatureConfigResolver always returns Optional.empty()")
+        .isEqualTo(10);
+
+    assertThat(
+            new DefaultConfigurationStore(staticConfig, Map.of(), k -> 
Optional.of(5))
+                .<Integer>getConfiguration(polarisCtx, key))
+        .as("The DynamicFeatureConfigResolver always returns 5")
+        .isEqualTo(5);
+  }
+
+  @ParameterizedTest
+  @MethodSource("getTestConfigs")
+  public void 
testPrecedenceIsDynamicThenStaticPerRealmThenStaticGlobal(TestConfig 
testConfig) {

Review Comment:
   Based on 
[this](https://github.com/apache/polaris/blob/d20cccd41da1c6ea554b4958619ed9863eeed3b6/polaris-core/src/main/java/org/apache/polaris/core/PolarisConfigurationStore.java#L112-L116)
 it already should. I assumed there were tests already for that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to