You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "dimas-b (via GitHub)" <gi...@apache.org> on 2026/09/02 15:50:39 UTC

Re: [PR] Return 400 for rename requests missing source or destination [polaris]

dimas-b commented on code in PR #5389:
URL: https://github.com/apache/polaris/pull/5389#discussion_r3915982170


##########
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapterTest.java:
##########
@@ -237,6 +240,68 @@ void testPaginationForFederatedCatalog(String initialPageToken, Integer pageSize
     }
   }
 
+  @Test
+  void testRenameTableRejectsMissingSource() throws IOException {
+    RenameTableRequest request =
+        renameRequest("{\"destination\":{\"namespace\":[\"ns\"],\"name\":\"newtable\"}}");
+    Assertions.assertThat(request.source()).isNull();
+    Assertions.assertThatThrownBy(
+            () ->
+                catalogAdapter.renameTable(
+                    FEDERATED_CATALOG_NAME,
+                    request,
+                    null,
+                    testServices.realmContext(),
+                    testServices.securityContext()))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessageContaining("source");
+  }
+
+  @Test
+  void testRenameTableRejectsMissingDestination() throws IOException {
+    RenameTableRequest request =
+        renameRequest("{\"source\":{\"namespace\":[\"ns\"],\"name\":\"oldtable\"}}");
+    Assertions.assertThat(request.destination()).isNull();
+    Assertions.assertThatThrownBy(
+            () ->
+                catalogAdapter.renameTable(
+                    FEDERATED_CATALOG_NAME,
+                    request,
+                    null,
+                    testServices.realmContext(),
+                    testServices.securityContext()))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessageContaining("destination");
+  }
+
+  @Test
+  void testRenameViewRejectsMissingSource() throws IOException {

Review Comment:
   True, but given that validation is done in the same method, current coverage is sufficient to ensure that view renames are validated completely. I'd be fine merging this "as is".



-- 
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-unsubscribe@polaris.apache.org

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