@@ -21,7 +21,7 @@ static int s_test_upload_request_checksum_context_get_checksum_cursor(struct aws
2121
2222 /* Test get checksum cursor with context that has no calculated checksum */
2323 struct aws_s3_upload_request_checksum_context * context =
24- aws_s3_upload_request_checksum_context_new (allocator , & config );
24+ aws_s3_upload_request_checksum_context_new (allocator , & config , false );
2525 ASSERT_NOT_NULL (context );
2626
2727 struct aws_byte_cursor cursor = aws_s3_upload_request_checksum_context_get_checksum_cursor (context );
@@ -32,8 +32,8 @@ static int s_test_upload_request_checksum_context_get_checksum_cursor(struct aws
3232
3333 /* Test get checksum cursor with context that has calculated checksum */
3434 struct aws_byte_cursor existing_checksum = aws_byte_cursor_from_c_str ("dGVzdA==" );
35- context =
36- aws_s3_upload_request_checksum_context_new_with_existing_base64_checksum ( allocator , & config , existing_checksum );
35+ context = aws_s3_upload_request_checksum_context_new_with_existing_base64_checksum (
36+ allocator , & config , existing_checksum , false );
3737 ASSERT_NOT_NULL (context );
3838
3939 cursor = aws_s3_upload_request_checksum_context_get_checksum_cursor (context );
@@ -49,6 +49,7 @@ static int s_test_upload_request_checksum_context_get_checksum_cursor(struct aws
4949
5050 return AWS_OP_SUCCESS ;
5151}
52+
5253AWS_TEST_CASE (
5354 test_upload_request_checksum_context_get_checksum_cursor ,
5455 s_test_upload_request_checksum_context_get_checksum_cursor )
@@ -68,7 +69,7 @@ static int s_test_upload_request_checksum_context_error_cases(struct aws_allocat
6869 struct aws_byte_cursor wrong_size_checksum = aws_byte_cursor_from_c_str ("short" );
6970 struct aws_s3_upload_request_checksum_context * context =
7071 aws_s3_upload_request_checksum_context_new_with_existing_base64_checksum (
71- allocator , & config , wrong_size_checksum );
72+ allocator , & config , wrong_size_checksum , false );
7273 ASSERT_NULL (context );
7374
7475 /* Test helper functions with NULL context */
@@ -80,6 +81,35 @@ static int s_test_upload_request_checksum_context_error_cases(struct aws_allocat
8081 ASSERT_NULL (aws_s3_upload_request_checksum_context_acquire (NULL ));
8182 ASSERT_NULL (aws_s3_upload_request_checksum_context_release (NULL ));
8283
84+ /* unknown algo */
85+ struct aws_s3_meta_request_checksum_config_storage config2 = {
86+ .allocator = allocator ,
87+ .checksum_algorithm = AWS_SCA_UNKNOWN ,
88+ .location = AWS_SCL_NONE ,
89+ .has_full_object_checksum = false,
90+ };
91+ struct aws_s3_upload_request_checksum_context * context2 =
92+ aws_s3_upload_request_checksum_context_new (allocator , & config2 , false);
93+
94+ ASSERT_NOT_NULL (context2 );
95+ ASSERT_FALSE (aws_s3_upload_request_checksum_context_should_calculate (context2 ));
96+
97+ /* unknown algo */
98+ struct aws_s3_meta_request_checksum_config_storage config3 = {
99+ .allocator = allocator ,
100+ .checksum_algorithm = AWS_SCA_CRC32 ,
101+ .location = AWS_SCL_NONE ,
102+ .has_full_object_checksum = false,
103+ };
104+ struct aws_s3_upload_request_checksum_context * context3 =
105+ aws_s3_upload_request_checksum_context_new (allocator , & config3 , false);
106+
107+ ASSERT_NOT_NULL (context3 );
108+ ASSERT_FALSE (aws_s3_upload_request_checksum_context_should_calculate (context3 ));
109+
110+ aws_s3_upload_request_checksum_context_release (context2 );
111+ aws_s3_upload_request_checksum_context_release (context3 );
112+
83113 return AWS_OP_SUCCESS ;
84114}
85115AWS_TEST_CASE (test_upload_request_checksum_context_error_cases , s_test_upload_request_checksum_context_error_cases )
@@ -101,7 +131,7 @@ static int s_test_upload_request_checksum_context_different_algorithms(struct aw
101131 AWS_ZERO_STRUCT (config .full_object_checksum );
102132
103133 struct aws_s3_upload_request_checksum_context * context =
104- aws_s3_upload_request_checksum_context_new (allocator , & config );
134+ aws_s3_upload_request_checksum_context_new (allocator , & config , false );
105135 ASSERT_NOT_NULL (context );
106136 ASSERT_INT_EQUALS (algorithms [i ], context -> algorithm );
107137 ASSERT_INT_EQUALS (AWS_SCL_HEADER , context -> location );
0 commit comments