sunyuhan1998 opened a new pull request, #10754:
URL: https://github.com/apache/gravitino/pull/10754

   The alter_tag method in `GravitinoMetalake` was incorrectly using POST 
instead of PUT to send tag update requests. The server-side `TagOperations` 
endpoint is annotated with `@PUT`, so the client must use PUT to match.
   
   Also fixed the corresponding unit test which was mocking `HTTPClient.post` 
instead of `HTTPClient.put`, and added an assertion to verify PUT is called.
   
   
   ### What changes were proposed in this pull request?
   
   Changed `alter_tag` in `GravitinoMetalake` to use HTTP PUT instead of POST, 
matching the server-side `TagOperations` endpoint which is annotated with 
`@PUT`. Also updated the corresponding unit test to mock `HTTPClient.put` and 
added an assertion to verify the correct HTTP method is called.
   
   ### Why are the changes needed?
   
   The `alter_tag` method was sending requests with HTTP POST, but the server 
expects PUT at the  `/api/metalakes/{metalake}/tags/{tag}` endpoint. This 
causes all `alter_tag` calls to fail with a 405 Method Not Allowed error when 
communicating with a real Gravitino server. The existing unit test did not 
catch this because it mocked `HTTPClient.post` and the integration-style tests 
in `mock_base.py` replaced the entire `alter_tag` method with a MagicMock, so 
the actual HTTP call was never exercised.
   
   Fix: #10753
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. This fixes a bug where `GravitinoMetalake.alter_tag()` would always 
fail with an HTTP 405 error. After this fix, the method works correctly with 
the server's PUT endpoint.
   
   ### How was this patch tested?
   
     - Existing unit tests updated: `test_gravitino_metalake_alter_tag_api` now 
mocks `HTTPClient.put` and asserts `mock_put.assert_called_once()`.
     - All Python client unit tests pass: `./gradlew 
:clients:client-python:test -PskipITs`
     - End-to-end verified against a running Gravitino server with tag rename, 
comment update, and property set/remove operations.
   


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