@@ -3350,6 +3350,79 @@ 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+
3357+ struct aws_future_s3_buffer_ticket * future = aws_future_s3_buffer_ticket_new ((struct aws_allocator * )pool -> impl );
3358+ aws_future_s3_buffer_ticket_set_error (future , AWS_ERROR_S3_BUFFER_ALLOCATION_FAILED );
3359+ return future ;
3360+ }
3361+
3362+ static struct aws_s3_buffer_pool_vtable s_failing_pool_vtable = {
3363+ .reserve = s_failing_pool_reserve ,
3364+ .trim = NULL ,
3365+ };
3366+
3367+ struct aws_s3_buffer_pool * s_always_error_buffer_pool_fn (struct aws_allocator * allocator ,
3368+ struct aws_s3_buffer_pool_config config ) {
3369+ struct aws_s3_buffer_pool * pool = aws_mem_calloc (allocator , 1 , sizeof (struct aws_s3_buffer_pool ));
3370+ pool -> impl = allocator ;
3371+ pool -> vtable = & s_failing_pool_vtable ;
3372+ aws_ref_count_init (& pool -> ref_count , pool , (aws_simple_completion_callback * )aws_s3_default_buffer_pool_destroy );
3373+ }
3374+
3375+ AWS_TEST_CASE (
3376+ test_s3_put_object_buffer_acquire_error ,
3377+ s_test_s3_put_object_buffer_acquire_error )
3378+ static int test_s3_put_object_buffer_acquire_error (struct aws_allocator * allocator , void * ctx ) {
3379+ (void )ctx ;
3380+
3381+ struct aws_s3_tester tester ;
3382+ ASSERT_SUCCESS (aws_s3_tester_init (allocator , & tester ));
3383+
3384+ struct aws_s3_client_config client_config = {
3385+ .part_size = 8 * 1024 * 1024 ,
3386+ .buffer_pool_factory_fn = s_always_error_buffer_pool_fn
3387+ };
3388+
3389+ ASSERT_SUCCESS (aws_s3_tester_bind_client (
3390+ & tester , & client_config , AWS_S3_TESTER_BIND_CLIENT_REGION | AWS_S3_TESTER_BIND_CLIENT_SIGNING ));
3391+
3392+ struct aws_s3_client * client = aws_s3_client_new (allocator , & client_config );
3393+
3394+ ASSERT_TRUE (client != NULL );
3395+
3396+ struct aws_byte_buf path_buf ;
3397+ AWS_ZERO_STRUCT (path_buf );
3398+
3399+ ASSERT_SUCCESS (aws_s3_tester_upload_file_path_init (
3400+ tester .allocator , & path_buf , aws_byte_cursor_from_c_str ("/prefix/round_trip/test_sse_c_fc.txt" )));
3401+
3402+ struct aws_byte_cursor object_path = aws_byte_cursor_from_buf (& path_buf );
3403+
3404+ struct aws_s3_tester_meta_request_options put_options = {
3405+ .allocator = allocator ,
3406+ .meta_request_type = AWS_S3_META_REQUEST_TYPE_PUT_OBJECT ,
3407+ .client = client ,
3408+ .sse_type = AWS_S3_TESTER_SSE_C_AES256 ,
3409+ .checksum_algorithm = AWS_SCA_CRC32 ,
3410+ .put_options =
3411+ {
3412+ .object_size_mb = 10 ,
3413+ .object_path_override = object_path ,
3414+ },
3415+ };
3416+
3417+ ASSERT_INT_EQUALS (AWS_ERROR_S3_BUFFER_ALLOCATION_FAILED , aws_s3_tester_send_meta_request_with_options (& tester , & put_options , NULL ));
3418+ client = aws_s3_client_release (client );
3419+
3420+ aws_byte_buf_clean_up (& path_buf );
3421+ aws_s3_tester_clean_up (& tester );
3422+
3423+ return 0 ;
3424+ }
3425+
33533426static int s_test_s3_put_object_content_md5_helper (
33543427 struct aws_allocator * allocator ,
33553428 bool multipart_upload ,
0 commit comments