Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Dec 10, 2024
2 parents 7f7a2a9 + 1e8a980 commit 40a2b56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ add_net_test_case(test_s3_round_trip_with_filepath)
add_net_test_case(test_s3_round_trip_mpu_with_filepath)
add_net_test_case(test_s3_round_trip_with_filepath_no_content_length)
add_net_test_case(test_s3_round_trip_mpu_with_filepath_no_content_length)
add_net_test_case(test_s3_round_trip_default_get_full_object_checksum_fc)
add_net_test_case(test_s3_round_trip_mpu_multipart_get_full_object_checksum_fc)
add_net_test_case(test_s3_round_trip_mpu_multipart_get_full_object_checksum_fc_header)
add_net_test_case(test_s3_round_trip_mpu_multipart_get_full_object_checksum_via_callback)
Expand Down
22 changes: 19 additions & 3 deletions tests/s3_data_plane_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3918,7 +3918,11 @@ void s_s3_test_no_validate_checksum(
}

/* TODO: maybe refactor the fc -> flexible checksum tests to be less copy/paste */
static int s_test_s3_round_trip_default_get_fc_helper(struct aws_allocator *allocator, void *ctx, bool via_header) {
static int s_test_s3_round_trip_default_get_fc_helper(
struct aws_allocator *allocator,
void *ctx,
bool via_header,
enum aws_s3_tester_full_object_checksum full_object_checksum) {
(void)ctx;

struct aws_s3_tester tester;
Expand Down Expand Up @@ -3960,6 +3964,10 @@ static int s_test_s3_round_trip_default_get_fc_helper(struct aws_allocator *allo
.object_path_override = object_path,
},
};
if (algorithm != AWS_SCA_SHA1 && algorithm != AWS_SCA_SHA256) {
/* Full object checksums doesn't support SHA. */
put_options.put_options.full_object_checksum = full_object_checksum;
}

ASSERT_SUCCESS(aws_s3_tester_send_meta_request_with_options(&tester, &put_options, NULL));

Expand Down Expand Up @@ -3992,12 +4000,18 @@ static int s_test_s3_round_trip_default_get_fc_helper(struct aws_allocator *allo

AWS_TEST_CASE(test_s3_round_trip_default_get_fc, s_test_s3_round_trip_default_get_fc)
static int s_test_s3_round_trip_default_get_fc(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_default_get_fc_helper(allocator, ctx, false);
return s_test_s3_round_trip_default_get_fc_helper(allocator, ctx, false, AWS_TEST_FOC_NONE);
}

AWS_TEST_CASE(test_s3_round_trip_default_get_fc_header, s_test_s3_round_trip_default_get_fc_header)
static int s_test_s3_round_trip_default_get_fc_header(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_default_get_fc_helper(allocator, ctx, true);
return s_test_s3_round_trip_default_get_fc_helper(allocator, ctx, true, AWS_TEST_FOC_NONE);
}
AWS_TEST_CASE(
test_s3_round_trip_default_get_full_object_checksum_fc,
s_test_s3_round_trip_default_get_full_object_checksum_fc)
static int s_test_s3_round_trip_default_get_full_object_checksum_fc(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_default_get_fc_helper(allocator, ctx, false, AWS_TEST_FOC_HEADER);
}

static int s_test_s3_round_trip_multipart_get_fc_helper(struct aws_allocator *allocator, void *ctx, bool via_header) {
Expand Down Expand Up @@ -4066,6 +4080,7 @@ AWS_TEST_CASE(test_s3_round_trip_multipart_get_fc, s_test_s3_round_trip_multipar
static int s_test_s3_round_trip_multipart_get_fc(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_multipart_get_fc_helper(allocator, ctx, false);
}

AWS_TEST_CASE(test_s3_round_trip_multipart_get_fc_header, s_test_s3_round_trip_multipart_get_fc_header)
static int s_test_s3_round_trip_multipart_get_fc_header(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_multipart_get_fc_helper(allocator, ctx, true);
Expand Down Expand Up @@ -4166,6 +4181,7 @@ AWS_TEST_CASE(
static int s_test_s3_round_trip_mpu_multipart_get_full_object_checksum_fc(struct aws_allocator *allocator, void *ctx) {
return s_test_s3_round_trip_mpu_multipart_get_fc_helper(allocator, ctx, false, AWS_TEST_FOC_HEADER);
}

AWS_TEST_CASE(
test_s3_round_trip_mpu_multipart_get_full_object_checksum_fc_header,
s_test_s3_round_trip_mpu_multipart_get_full_object_checksum_fc_header)
Expand Down

0 comments on commit 40a2b56

Please sign in to comment.