eric-maynard commented on code in PR #1959:
URL: https://github.com/apache/polaris/pull/1959#discussion_r2195770517


##########
polaris-core/src/test/java/org/apache/polaris/service/storage/PolarisConfigurationStoreTest.java:
##########
@@ -186,4 +185,78 @@ public void testEntityOverrides() {
     Assertions.assertEquals(
         "entity-legacy4", store.getConfiguration(testRealmContext, entity, 
cfg.apply(4)));
   }
+
+  @Test
+  public void testLegacyKeyLookup() {
+    FeatureConfiguration<String> config =
+        PolarisConfiguration.<String>builder()
+            .key("LEGACY_KEY_TEST_NEW_KEY")
+            .legacyKey("LEGACY_TEST_OLD_KEY_1")
+            .legacyKey("LEGACY_TEST_OLD_KEY_2")
+            .description("Test config with legacy keys")
+            .defaultValue("default-value")
+            .buildFeatureConfiguration();
+
+    PolarisConfigurationStore store =
+        new PolarisConfigurationStore() {
+          @SuppressWarnings("unchecked")
+          @Override
+          public <T> T getConfiguration(@Nonnull RealmContext ctx, String 
configName) {
+            Map<String, String> values = Map.of("LEGACY_TEST_OLD_KEY_1", 
"legacy-value-1");
+            return (T) values.get(configName);
+          }
+        };
+
+    String result = store.getConfiguration(testRealmContext, config);
+    Assertions.assertEquals("legacy-value-1", result);
+  }
+
+  @Test
+  public void testMainKeyTakesPrecedenceOverLegacyKeys() {

Review Comment:
   If this happens, we should probably actually error



##########
polaris-core/src/test/java/org/apache/polaris/service/storage/PolarisConfigurationStoreTest.java:
##########
@@ -186,4 +185,78 @@ public void testEntityOverrides() {
     Assertions.assertEquals(
         "entity-legacy4", store.getConfiguration(testRealmContext, entity, 
cfg.apply(4)));
   }
+
+  @Test

Review Comment:
   It would be nice to add a test for conflicting legacy keys



-- 
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