]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1357] Improved forceUDPSendFailure UTs
authorFrancis Dupont <fdupont@isc.org>
Mon, 7 Sep 2020 15:28:29 +0000 (17:28 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 7 Sep 2020 15:28:29 +0000 (17:28 +0200)
src/bin/dhcp4/tests/d2_unittest.cc
src/bin/dhcp6/tests/d2_unittest.cc

index 8b42d72c80852609f1d3e3009d292d59c68a4194..d0e25a64396a435637333c85a8590ae5ab5e5129 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -292,7 +292,7 @@ TEST_F(Dhcp4SrvD2Test, simpleUDPSend) {
 // Checks that an IO error in sending a request to D2, results in ddns updates
 // being suspended.  This indicates that Dhcp4Srv's error handler has been
 // invoked as expected.  Note that this unit test relies on an attempt to send
-// to a server address of 0.0.0.0 port 0 fails, which it does  under all OSes
+// to a server address of 0.0.0.0 port 0 fails, which it does under all OSes
 // except Solaris 11.
 /// @todo Eventually we should find a way to test this under Solaris.
 #ifndef OS_SOLARIS
@@ -312,7 +312,13 @@ TEST_F(Dhcp4SrvD2Test, DISABLED_forceUDPSendFailure) {
     ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0,
                                         "0.0.0.0", 53001));
     ASSERT_TRUE(mgr.ddnsEnabled());
-    ASSERT_NO_THROW(srv_.startD2());
+    try {
+        srv_.startD2();
+    } catch (const std::exception& ex) {
+        FAIL() << "startD2 failed with " << ex.what();
+    } catch (...) {
+        FAIL() << "startD2 failed";
+    }
     ASSERT_TRUE(mgr.amSending());
 
     // Queue up 3 messages.
index 6a20774da874c22b343701a549b8b41a3b10839f..25a70e413f4611fde81ad92a994fbc455913dc24 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -297,7 +297,7 @@ TEST_F(Dhcp6SrvD2Test, simpleUDPSend) {
 // Checks that an IO error in sending a request to D2, results in ddns updates
 // being suspended.  This indicates that Dhcp6Srv's error handler has been
 // invoked as expected.  Note that this unit test relies on an attempt to send
-// to a server address of 0.0.0.0 port 0 fails, which it does  under all OSs
+// to a server address of 0.0.0.0 port 0 fails, which it does under all OSs
 // except Solaris 11.
 /// @todo Eventually we should find a way to test this under Solaris.
 #ifndef OS_SOLARIS
@@ -317,7 +317,13 @@ TEST_F(Dhcp6SrvD2Test, DISABLED_forceUDPSendFailure) {
     ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "::", 0,
                                         "::", 53001));
     ASSERT_TRUE(mgr.ddnsEnabled());
-    ASSERT_NO_THROW(srv_.startD2());
+    try {
+        srv_.startD2();
+    } catch (const std::exception& ex) {
+        FAIL() << "startD2 failed with " << ex.what();
+    } catch (...) {
+        FAIL() << "startD2 failed";
+    }
     ASSERT_TRUE(mgr.amSending());
 
     // Queue up 3 messages.