From 7dd41466b473c2170a76bf920ce3292f56abb3d8 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Mon, 28 Oct 2024 09:47:07 +0200 Subject: [PATCH] [#3602] Add test failure on exception thrown --- src/bin/dhcp4/tests/http_control_socket_unittest.cc | 5 ++++- src/bin/dhcp6/tests/http_control_socket_unittest.cc | 5 ++++- src/lib/http/connection_pool.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bin/dhcp4/tests/http_control_socket_unittest.cc b/src/bin/dhcp4/tests/http_control_socket_unittest.cc index 38880683c2..0a26edb3dd 100644 --- a/src/bin/dhcp4/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp4/tests/http_control_socket_unittest.cc @@ -150,8 +150,11 @@ class BaseCtrlChannelDhcpv4Test : public ::testing::Test { TEST_TIMEOUT, IntervalTimer::ONE_SHOT); // Run until the client stops the service or an error occurs. try { - io_service->run(); + io_service->run(); + } catch (const std::exception& ex) { + ADD_FAILURE() << "Exception thrown while running test. Error: " << ex.what(); } catch (...) { + ADD_FAILURE() << "Unknown exception thrown while running test."; } test_timer.cancel(); if (io_service->stopped()) { diff --git a/src/bin/dhcp6/tests/http_control_socket_unittest.cc b/src/bin/dhcp6/tests/http_control_socket_unittest.cc index 0c72acc840..82d35f4992 100644 --- a/src/bin/dhcp6/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp6/tests/http_control_socket_unittest.cc @@ -188,8 +188,11 @@ class BaseCtrlChannelDhcpv6Test : public HttpCtrlDhcpv6Test { TEST_TIMEOUT, IntervalTimer::ONE_SHOT); // Run until the client stops the service or an error occurs. try { - io_service->run(); + io_service->run(); + } catch (const std::exception& ex) { + ADD_FAILURE() << "Exception thrown while running test. Error: " << ex.what(); } catch (...) { + ADD_FAILURE() << "Unknown exception thrown while running test."; } test_timer.cancel(); if (io_service->stopped()) { diff --git a/src/lib/http/connection_pool.h b/src/lib/http/connection_pool.h index d5a995bc31..8d382446ce 100644 --- a/src/lib/http/connection_pool.h +++ b/src/lib/http/connection_pool.h @@ -71,7 +71,7 @@ class HttpConnectionPool { std::mutex mutex_; }; -/// @brief Pointer to the @ref HttpConnection. +/// @brief Pointer to the @ref HttpConnectionPool. typedef std::shared_ptr HttpConnectionPoolPtr; }