@@ -3350,6 +3350,91 @@ static int s_test_s3_put_object_sse_c_aes256_multipart_with_checksum(struct aws_
33503350 return 0 ;
33513351}
33523352
3353+ struct aws_future_s3_buffer_ticket * s_failing_pool_reserve (
3354+ struct aws_s3_buffer_pool * pool ,
3355+ struct aws_s3_buffer_pool_reserve_meta meta ) {
3356+ (void )meta ;
3357+
3358+ struct aws_future_s3_buffer_ticket * future = aws_future_s3_buffer_ticket_new ((struct aws_allocator * )pool -> impl );
3359+ aws_future_s3_buffer_ticket_set_error (future , AWS_ERROR_S3_BUFFER_ALLOCATION_FAILED );
3360+ return future ;
3361+ }
3362+
3363+ void s_failing_pool_trim (struct aws_s3_buffer_pool * pool ) {
3364+ (void )pool ;
3365+ }
3366+
3367+ static struct aws_s3_buffer_pool_vtable s_failing_pool_vtable = {
3368+ .reserve = s_failing_pool_reserve ,
3369+ .trim = s_failing_pool_trim ,
3370+ };
3371+
3372+ void s_failing_pool_destroy (struct aws_s3_buffer_pool * buffer_pool_wrapper ) {
3373+ aws_mem_release ((struct aws_allocator * )buffer_pool_wrapper -> impl , buffer_pool_wrapper );
3374+ }
3375+
3376+ struct aws_s3_buffer_pool * s_always_error_buffer_pool_fn (
3377+ struct aws_allocator * allocator ,
3378+ struct aws_s3_buffer_pool_config config ) {
3379+ (void )config ;
3380+ struct aws_s3_buffer_pool * pool = aws_mem_calloc (allocator , 1 , sizeof (struct aws_s3_buffer_pool ));
3381+ pool -> impl = allocator ;
3382+ pool -> vtable = & s_failing_pool_vtable ;
3383+ aws_ref_count_init (& pool -> ref_count , pool , (aws_simple_completion_callback * )s_failing_pool_destroy );
3384+
3385+ return pool ;
3386+ }
3387+
3388+ AWS_TEST_CASE (test_s3_put_object_buffer_acquire_error , s_test_s3_put_object_buffer_acquire_error )
3389+ static int s_test_s3_put_object_buffer_acquire_error (struct aws_allocator * allocator , void * ctx ) {
3390+ (void )ctx ;
3391+
3392+ struct aws_s3_tester tester ;
3393+ ASSERT_SUCCESS (aws_s3_tester_init (allocator , & tester ));
3394+
3395+ struct aws_s3_client_config client_config = {
3396+ .part_size = 8 * 1024 * 1024 , .buffer_pool_factory_fn = s_always_error_buffer_pool_fn };
3397+
3398+ ASSERT_SUCCESS (aws_s3_tester_bind_client (
3399+ & tester , & client_config , AWS_S3_TESTER_BIND_CLIENT_REGION | AWS_S3_TESTER_BIND_CLIENT_SIGNING ));
3400+
3401+ struct aws_s3_client * client = aws_s3_client_new (allocator , & client_config );
3402+
3403+ ASSERT_TRUE (client != NULL );
3404+
3405+ struct aws_byte_buf path_buf ;
3406+ AWS_ZERO_STRUCT (path_buf );
3407+
3408+ ASSERT_SUCCESS (aws_s3_tester_upload_file_path_init (
3409+ tester .allocator , & path_buf , aws_byte_cursor_from_c_str ("/prefix/round_trip/test_acquire_buffer_error.txt" )));
3410+
3411+ struct aws_byte_cursor object_path = aws_byte_cursor_from_buf (& path_buf );
3412+
3413+ struct aws_s3_tester_meta_request_options put_options = {
3414+ .allocator = allocator ,
3415+ .meta_request_type = AWS_S3_META_REQUEST_TYPE_PUT_OBJECT ,
3416+ .client = client ,
3417+ .validate_type = AWS_S3_TESTER_VALIDATE_TYPE_EXPECT_FAILURE ,
3418+ .put_options =
3419+ {
3420+ .object_size_mb = 10 ,
3421+ .object_path_override = object_path ,
3422+ },
3423+ };
3424+
3425+ struct aws_s3_meta_request_test_results meta_request_test_results ;
3426+ aws_s3_meta_request_test_results_init (& meta_request_test_results , allocator );
3427+ ASSERT_SUCCESS (aws_s3_tester_send_meta_request_with_options (& tester , & put_options , & meta_request_test_results ));
3428+ ASSERT_INT_EQUALS (AWS_ERROR_S3_BUFFER_ALLOCATION_FAILED , meta_request_test_results .finished_error_code );
3429+ client = aws_s3_client_release (client );
3430+
3431+ aws_s3_meta_request_test_results_clean_up (& meta_request_test_results );
3432+ aws_byte_buf_clean_up (& path_buf );
3433+ aws_s3_tester_clean_up (& tester );
3434+
3435+ return 0 ;
3436+ }
3437+
33533438static int s_test_s3_put_object_content_md5_helper (
33543439 struct aws_allocator * allocator ,
33553440 bool multipart_upload ,
0 commit comments