dimas-b commented on code in PR #8857: URL: https://github.com/apache/iceberg/pull/8857#discussion_r1415657426
########## nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java: ########## @@ -67,33 +71,84 @@ public void afterEach() throws Exception { } @Test - public void testListNamespaces() { + public void testListNamespaces() throws NessieConflictException, NessieNotFoundException { + Assertions.assertThat(catalog.listNamespaces()).isEmpty(); + Assertions.assertThat(anotherCatalog.listNamespaces()).isEmpty(); + + // listing a non-existent namespace should return empty + Assertions.assertThat(catalog.listNamespaces(Namespace.of("db1"))).isEmpty(); + Assertions.assertThat(anotherCatalog.listNamespaces(Namespace.of("db1"))).isEmpty(); + catalog.createNamespace(Namespace.of("db1"), Collections.emptyMap()); + Assertions.assertThat(catalog.listNamespaces()).containsExactlyInAnyOrder(Namespace.of("db1")); + Assertions.assertThat(anotherCatalog.listNamespaces()) + .containsExactlyInAnyOrder(Namespace.of("db1")); // another client creates a namespace with the same nessie server anotherCatalog.createNamespace(Namespace.of("db2"), Collections.emptyMap()); - Assertions.assertThat(anotherCatalog.listNamespaces()) - .containsExactlyInAnyOrder(Namespace.of("db1"), Namespace.of("db2")); Assertions.assertThat(catalog.listNamespaces()) .containsExactlyInAnyOrder(Namespace.of("db1"), Namespace.of("db2")); + Assertions.assertThat(anotherCatalog.listNamespaces()) + .containsExactlyInAnyOrder(Namespace.of("db1"), Namespace.of("db2")); + + api.deleteBranch().branch((Branch) api.getReference().refName(branch).get()).delete(); + + Assertions.assertThatThrownBy(() -> catalog.listNamespaces()) + .hasMessageContaining( + "Cannot list top-level namespaces: ref '%s' is no longer valid", branch); + Assertions.assertThatThrownBy(() -> anotherCatalog.listNamespaces(Namespace.of("db1"))) + .hasMessageContaining( + "Cannot list child namespaces from 'db1': ref '%s' is no longer valid", branch); } @Test - public void testLoadNamespaceMetadata() { + public void testLoadNamespaceMetadata() throws NessieConflictException, NessieNotFoundException { + + Assertions.assertThatThrownBy(() -> catalog.loadNamespaceMetadata(Namespace.of("namespace1"))) Review Comment: I agree on addressing this in a follow-up PR. As for me, I think we also need to synchronize reference refreshes across tables. Currently, each table tracks its own hash (even when the user does not explicitly request it), which is not ideal, IMHO. -- 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...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org