Commit 0bcf0ca9 authored by Razvan Becheriu's avatar Razvan Becheriu

[#840, !27-p] fixed freebsd unittests

parent bf962d02
...@@ -454,7 +454,7 @@ public: ...@@ -454,7 +454,7 @@ public:
auto found_network = networks->getByName("one"); auto found_network = networks->getByName("one");
if (fetchConfigElement("dhcp4_shared_network") && if (fetchConfigElement("dhcp4_shared_network") &&
(getTimestamp("dhcp4_shared_network") > lb_modification_time)) { (getTimestamp("dhcp4_shared_network") > lb_modification_time)) {
EXPECT_TRUE(found_network); ASSERT_TRUE(found_network);
EXPECT_TRUE(found_network->hasFetchGlobalsFn()); EXPECT_TRUE(found_network->hasFetchGlobalsFn());
} else { } else {
......
...@@ -41,6 +41,11 @@ public: ...@@ -41,6 +41,11 @@ public:
/// 0 and 0x32. /// 0 and 0x32.
CfgHostsTest(); CfgHostsTest();
/// @brief Destructor.
///
/// This destructor resets global state after tests are run.
~CfgHostsTest();
/// @brief Increases last byte of an address. /// @brief Increases last byte of an address.
/// ///
/// @param address Address to be increased. /// @param address Address to be increased.
...@@ -88,6 +93,10 @@ CfgHostsTest::CfgHostsTest() { ...@@ -88,6 +93,10 @@ CfgHostsTest::CfgHostsTest() {
} }
} }
CfgHostsTest::~CfgHostsTest() {
CfgMgr::instance().setFamily(AF_INET);
}
IOAddress IOAddress
CfgHostsTest::increase(const IOAddress& address, const uint8_t num) const { CfgHostsTest::increase(const IOAddress& address, const uint8_t num) const {
std::vector<uint8_t> vec = address.toBytes(); std::vector<uint8_t> vec = address.toBytes();
......
...@@ -424,6 +424,9 @@ TEST_F(CfgMgrTest, d2ClientConfig) { ...@@ -424,6 +424,9 @@ TEST_F(CfgMgrTest, d2ClientConfig) {
// and not the original configuration. // and not the original configuration.
EXPECT_EQ(*new_cfg, *updated_config); EXPECT_EQ(*new_cfg, *updated_config);
EXPECT_NE(*original_config, *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 // This test verifies that the configuration staging, commit and rollback works
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment