]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#840, !27-p] fixed freebsd unittests
authorRazvan Becheriu <razvan@isc.org>
Sat, 24 Aug 2019 07:42:21 +0000 (10:42 +0300)
committerRazvan Becheriu <razvan@isc.org>
Sat, 24 Aug 2019 07:42:21 +0000 (10:42 +0300)
src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc
src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
src/lib/dhcpsrv/tests/cfgmgr_unittest.cc

index ff0f8ef362178755b2494b72faafb2b2fa704569..118fe1bd4d934e530f38c680a15d6ac0520379bc 100644 (file)
@@ -454,7 +454,7 @@ public:
         auto found_network = networks->getByName("one");
         if (fetchConfigElement("dhcp4_shared_network") &&
             (getTimestamp("dhcp4_shared_network") > lb_modification_time)) {
-            EXPECT_TRUE(found_network);
+            ASSERT_TRUE(found_network);
             EXPECT_TRUE(found_network->hasFetchGlobalsFn());
 
         } else {
index 97ce820176cf47bcc554a705e079ef1dd7f556d2..a27e8c711f83fcfbee413db2de75dec5ec635aad 100644 (file)
@@ -41,6 +41,11 @@ public:
     /// 0 and 0x32.
     CfgHostsTest();
 
+    /// @brief Destructor.
+    ///
+    /// This destructor resets global state after tests are run.
+    ~CfgHostsTest();
+
     /// @brief Increases last byte of an address.
     ///
     /// @param address Address to be increased.
@@ -88,6 +93,10 @@ CfgHostsTest::CfgHostsTest() {
     }
 }
 
+CfgHostsTest::~CfgHostsTest() {
+    CfgMgr::instance().setFamily(AF_INET);
+}
+
 IOAddress
 CfgHostsTest::increase(const IOAddress& address, const uint8_t num) const {
     std::vector<uint8_t> vec = address.toBytes();
index 408168e071b351ed6a45ade463269c564210cea7..1069de2365dce034cec61cfc8d99debe5068f566 100644 (file)
@@ -424,6 +424,9 @@ TEST_F(CfgMgrTest, d2ClientConfig) {
     // and not the original configuration.
     EXPECT_EQ(*new_cfg, *updated_config);
     EXPECT_NE(*original_config, *updated_config);
+
+    // Revert to default configuration.
+    ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(original_config));
 }
 
 // This test verifies that the configuration staging, commit and rollback works