liamzwbao commented on code in PR #1289:
URL: https://github.com/apache/polaris/pull/1289#discussion_r2025682232


##########
quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java:
##########
@@ -386,18 +386,27 @@ public Map<String, BaseResult> 
purgeRealms(Iterable<String> realms) {
     };
   }
 
-  /** TODO: Unblock this test, see: 
https://github.com/apache/polaris/issues/1272 */
   @Override
   @Test
-  @Disabled(
-      """
-      Disabled because the behavior is not applicable to Polaris.
-      To unblock:
-      1) Align Polaris behavior with the superclass by handling empty 
namespaces the same way, or
-      2) Modify this test to expect an exception and add a Polaris-specific 
version.
-      """)
   public void listNamespacesWithEmptyNamespace() {
-    super.listNamespacesWithEmptyNamespace();
+    // In Polaris, the empty namespace implicitly exists by default.
+    // The superclass test assumes the empty namespace does not exist 
initially,
+    // so running it will fail as expected.
+    Assertions.assertThatThrownBy(super::listNamespacesWithEmptyNamespace)
+        .isInstanceOf(AssertionFailedError.class);

Review Comment:
   `@Disabled` skips the test completely, so we won't notice if something 
changes in the superclass. But if we override the test instead, we can still 
run it and catch any changes in the future.



##########
quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java:
##########
@@ -386,18 +386,27 @@ public Map<String, BaseResult> 
purgeRealms(Iterable<String> realms) {
     };
   }
 
-  /** TODO: Unblock this test, see: 
https://github.com/apache/polaris/issues/1272 */
   @Override
   @Test
-  @Disabled(
-      """
-      Disabled because the behavior is not applicable to Polaris.
-      To unblock:
-      1) Align Polaris behavior with the superclass by handling empty 
namespaces the same way, or
-      2) Modify this test to expect an exception and add a Polaris-specific 
version.
-      """)
   public void listNamespacesWithEmptyNamespace() {
-    super.listNamespacesWithEmptyNamespace();
+    // In Polaris, the empty namespace implicitly exists by default.
+    // The superclass test assumes the empty namespace does not exist 
initially,
+    // so running it will fail as expected.
+    Assertions.assertThatThrownBy(super::listNamespacesWithEmptyNamespace)
+        .isInstanceOf(AssertionFailedError.class);
+  }
+
+  @Test
+  public void listNamespacesWithEmptyNamespaceInPolaris() {
+    catalog().createNamespace(NS);
+
+    
Assertions.assertThat(catalog().namespaceExists(Namespace.empty())).isTrue();
+    Assertions.assertThat(catalog().listNamespaces())
+        .contains(NS)
+        .doesNotContain(Namespace.empty());

Review Comment:
   Yes! Thanks for pointing it out.



##########
quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java:
##########
@@ -386,18 +386,27 @@ public Map<String, BaseResult> 
purgeRealms(Iterable<String> realms) {
     };
   }
 
-  /** TODO: Unblock this test, see: 
https://github.com/apache/polaris/issues/1272 */
   @Override
   @Test
-  @Disabled(
-      """
-      Disabled because the behavior is not applicable to Polaris.
-      To unblock:
-      1) Align Polaris behavior with the superclass by handling empty 
namespaces the same way, or
-      2) Modify this test to expect an exception and add a Polaris-specific 
version.
-      """)
   public void listNamespacesWithEmptyNamespace() {
-    super.listNamespacesWithEmptyNamespace();
+    // In Polaris, the empty namespace implicitly exists by default.
+    // The superclass test assumes the empty namespace does not exist 
initially,
+    // so running it will fail as expected.
+    Assertions.assertThatThrownBy(super::listNamespacesWithEmptyNamespace)
+        .isInstanceOf(AssertionFailedError.class);
+  }
+
+  @Test
+  public void listNamespacesWithEmptyNamespaceInPolaris() {
+    catalog().createNamespace(NS);
+
+    
Assertions.assertThat(catalog().namespaceExists(Namespace.empty())).isTrue();
+    Assertions.assertThat(catalog().listNamespaces())
+        .contains(NS)
+        .doesNotContain(Namespace.empty());

Review Comment:
   I think the reason is that `Namespace.empty()` represents the root namespace 
in Polaris and is created implicitly. When we call `listNamespaces` without any 
arg, it returns namespaces under the root—i.e., under `Namespace.empty()`. In 
this case, we only created `NS`, so it's the only one listed. Since creating an 
"empty" namespace isn’t something we officially support I guess, there’s no 
empty namespace under the root empty namespace.
   
   That said, I’m happy to clarify what behavior we actually want here and fix 
it if it turns out to be a bug.



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to