From 03c7ca4b54b65268e7c6406182510b6961222a8e Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 21 Mar 2023 15:12:08 -0700 Subject: [PATCH] Mark "net tests" that need to create a valid TLS ctx (#85) In some environments, we can't set up TLS, so don't run these tests. --- tests/CMakeLists.txt | 18 +++++++++--------- tests/secure_tunnel_tests.c | 5 +++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 19bf90aa..cee0e152 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,15 +19,15 @@ if (UNIX AND NOT APPLE) add_test_case(devicedefender_publish_failure_callback_invoked) endif() -add_test_case(secure_tunneling_functionality_connect_test) -add_test_case(secure_tunneling_functionality_client_token_test) -add_test_case(secure_tunneling_fail_and_retry_connection_test) -add_test_case(secure_tunneling_store_service_ids_test) -add_test_case(secure_tunneling_receive_stream_start_test) -add_test_case(secure_tunneling_rejected_service_id_stream_start_test) -add_test_case(secure_tunneling_close_stream_on_stream_reset_test) -add_test_case(secure_tunneling_session_reset_test) -add_test_case(secure_tunneling_serializer_data_message_test) +add_net_test_case(secure_tunneling_functionality_connect_test) +add_net_test_case(secure_tunneling_functionality_client_token_test) +add_net_test_case(secure_tunneling_fail_and_retry_connection_test) +add_net_test_case(secure_tunneling_store_service_ids_test) +add_net_test_case(secure_tunneling_receive_stream_start_test) +add_net_test_case(secure_tunneling_rejected_service_id_stream_start_test) +add_net_test_case(secure_tunneling_close_stream_on_stream_reset_test) +add_net_test_case(secure_tunneling_session_reset_test) +add_net_test_case(secure_tunneling_serializer_data_message_test) generate_test_driver(${PROJECT_NAME}-tests) diff --git a/tests/secure_tunnel_tests.c b/tests/secure_tunnel_tests.c index c5678ae3..795c0bf8 100644 --- a/tests/secure_tunnel_tests.c +++ b/tests/secure_tunnel_tests.c @@ -443,11 +443,14 @@ int aws_secure_tunnel_mock_test_fixture_init( test_fixture->socket_options = socket_options; test_fixture->secure_tunnel_elg = aws_event_loop_group_new_default(allocator, 4, NULL); + ASSERT_NOT_NULL(test_fixture->secure_tunnel_elg); + struct aws_host_resolver_default_options resolver_options = { .el_group = test_fixture->secure_tunnel_elg, .max_entries = 1, }; test_fixture->host_resolver = aws_host_resolver_new_default(allocator, &resolver_options); + ASSERT_NOT_NULL(test_fixture->host_resolver); struct aws_client_bootstrap_options bootstrap_options = { .event_loop_group = test_fixture->secure_tunnel_elg, @@ -456,6 +459,7 @@ int aws_secure_tunnel_mock_test_fixture_init( }; test_fixture->secure_tunnel_bootstrap = aws_client_bootstrap_new(allocator, &bootstrap_options); + ASSERT_NOT_NULL(test_fixture->secure_tunnel_bootstrap); uint64_t timestamp = 0; ASSERT_SUCCESS(aws_sys_clock_get_ticks(×tamp)); @@ -485,6 +489,7 @@ int aws_secure_tunnel_mock_test_fixture_init( options->secure_tunnel_options->secure_tunnel_on_termination_user_data = test_fixture; test_fixture->secure_tunnel = aws_secure_tunnel_new(allocator, options->secure_tunnel_options); + ASSERT_NOT_NULL(test_fixture->secure_tunnel); /* Replace Secure Tunnel's vtable functions */ test_fixture->secure_tunnel_vtable = *aws_secure_tunnel_get_default_vtable();