Skip to content

Commit

Permalink
add test for early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Oct 15, 2024
1 parent 81109f5 commit 5d0a2e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ add_test_case(test_s3_abort_multipart_upload_message_new)

add_net_test_case(test_s3_client_create_destroy)
add_net_test_case(test_s3_client_create_error)
add_net_test_case(test_s3_client_create_error_with_invalid_memory_config)
add_net_test_case(test_s3_client_create_error_with_invalid_network_interface)
add_net_test_case(test_s3_client_monitoring_options_override)
add_net_test_case(test_s3_client_proxy_ev_settings_override)
Expand Down
27 changes: 27 additions & 0 deletions tests/s3_data_plane_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,33 @@ static int s_test_s3_client_create_error(struct aws_allocator *allocator, void *
return 0;
}

AWS_TEST_CASE(
test_s3_client_create_error_with_invalid_memory_config,
s_test_s3_client_create_error_with_invalid_memory_config)
static int s_test_s3_client_create_error_with_invalid_memory_config(struct aws_allocator *allocator, void *ctx) {
(void)ctx;

struct aws_s3_tester tester;
AWS_ZERO_STRUCT(tester);
ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester));

struct aws_s3_client_config client_config;
AWS_ZERO_STRUCT(client_config);
ASSERT_SUCCESS(aws_s3_tester_bind_client(&tester, &client_config, AWS_S3_TESTER_BIND_CLIENT_REGION));

client_config.memory_limit_in_bytes = 100;
struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config);
ASSERT_TRUE(client == NULL);
client_config.memory_limit_in_bytes = GB_TO_BYTES(1);
client_config.max_part_size = GB_TO_BYTES(2);
client = aws_s3_client_new(allocator, &client_config);
ASSERT_TRUE(client == NULL);

tester.bound_to_client = false;
aws_s3_tester_clean_up(&tester);
return 0;
}

AWS_TEST_CASE(
test_s3_client_create_error_with_invalid_network_interface,
s_test_s3_client_create_error_with_invalid_network_interface)
Expand Down

0 comments on commit 5d0a2e2

Please sign in to comment.