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

Xuanwo pushed a commit to branch xuanwo/fix-c-presign-write-status
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit df3f4f942aff54304626ef1b91c8edb842410764
Author: Xuanwo <[email protected]>
AuthorDate: Mon Nov 30 20:45:13 2026 +0100

    test(bindings/c): check presigned upload HTTP status
    
    Check the final upload response before stat and report its status when the 
response is outside the 2xx range. Keep the metadata and byte readback checks 
after a successful response.
---
 bindings/c/tests/test_suites_presign.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bindings/c/tests/test_suites_presign.cpp 
b/bindings/c/tests/test_suites_presign.cpp
index 5e6431449a..cba41a0e18 100644
--- a/bindings/c/tests/test_suites_presign.cpp
+++ b/bindings/c/tests/test_suites_presign.cpp
@@ -633,14 +633,19 @@ void test_presign_write(opendal_test_context* ctx)
     }
 
     CURLcode res = curl_easy_perform(curl);
-    if (res != CURLE_OK) {
-        presign_cleanup_curl(curl, chunk);
-        OPENDAL_ASSERT_EQ(CURLE_OK, res, "CURL perform should succeed");
-    }
+    long response_code = 0;
+    CURLcode info_res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, 
&response_code);
 
     presign_cleanup_curl(curl, chunk);
     opendal_presigned_request_free(req);
 
+    OPENDAL_ASSERT_EQ(CURLE_OK, res, "CURL perform should succeed");
+    OPENDAL_ASSERT_EQ(CURLE_OK, info_res, "Retrieving response code should 
succeed");
+    char status_message[96];
+    snprintf(status_message, sizeof(status_message),
+        "Presigned upload returned HTTP %ld (expected 2xx)", response_code);
+    OPENDAL_ASSERT(response_code >= 200 && response_code < 300, 
status_message);
+
     opendal_metadata* meta = NULL;
     error = opendal_operator_stat(ctx->config->operator_instance, path, &meta);
     OPENDAL_ASSERT_NO_ERROR(error, "Stat after presign write should succeed");

Reply via email to