This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new c338323b2e Core: Test loading table/view with non-existing namespace 
(#12812)
c338323b2e is described below

commit c338323b2e9cd8a862fdf328ceacc1b59ea6275a
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Wed Apr 16 13:06:53 2025 +0200

    Core: Test loading table/view with non-existing namespace (#12812)
---
 core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java  | 9 +++++++++
 core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java 
b/core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
index d6f849d59e..d421f6990b 100644
--- a/core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
+++ b/core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
@@ -917,6 +917,15 @@ public abstract class CatalogTests<C extends Catalog & 
SupportsNamespaces> {
         .containsAll(properties.entrySet());
   }
 
+  @Test
+  public void testLoadTableWithNonExistingNamespace() {
+    TableIdentifier ident = TableIdentifier.of("non-existing", "tbl");
+    assertThat(catalog().tableExists(ident)).as("Table should not 
exist").isFalse();
+    assertThatThrownBy(() -> catalog().loadTable(ident))
+        .isInstanceOf(NoSuchTableException.class)
+        .hasMessageStartingWith("Table does not exist: %s", ident);
+  }
+
   @Test
   public void testLoadMetadataTable() {
     C catalog = catalog();
diff --git a/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java 
b/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java
index 81f0d6d577..96afbe4878 100644
--- a/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java
+++ b/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java
@@ -78,6 +78,15 @@ public abstract class ViewCatalogTests<C extends ViewCatalog 
& SupportsNamespace
     return false;
   }
 
+  @Test
+  public void loadViewWithNonExistingNamespace() {
+    TableIdentifier ident = TableIdentifier.of("non-existing", "view");
+    assertThat(catalog().viewExists(ident)).as("View should not 
exist").isFalse();
+    assertThatThrownBy(() -> catalog().loadView(ident))
+        .isInstanceOf(NoSuchViewException.class)
+        .hasMessageStartingWith("View does not exist: %s", ident);
+  }
+
   @Test
   public void basicCreateView() {
     TableIdentifier identifier = TableIdentifier.of("ns", "view");

Reply via email to