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

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


The following commit(s) were added to refs/heads/main by this push:
     new 60c8b14b22 test(bindings/c): check presigned upload HTTP status (#9456)
60c8b14b22 is described below

commit 60c8b14b22617fafa052f82089782f298736d1ef
Author: Xuanwo <[email protected]>
AuthorDate: Tue Dec 1 04:16:23 2026 +0800

    test(bindings/c): check presigned upload HTTP status (#9456)
    
    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