diff options
author | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2018-11-28 18:40:16 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2018-11-30 20:42:02 +0530 |
commit | 35297177b81061c3ac6658412c6306556849790a (patch) | |
tree | 9a2a63e74cf4cb2930bca7587fef91f855e8aa0e /network_manager.hpp | |
parent | 450b346910a7bcf9abde55d76693539a83bf33f7 (diff) | |
download | phosphor-networkd-35297177b81061c3ac6658412c6306556849790a.tar.gz phosphor-networkd-35297177b81061c3ac6658412c6306556849790a.zip |
Re-enable unit test
Unit test were broken after sd bus calls started throwing exception,
In this repo we start the systemd-networkd with the use of sd bus
calls, which throws exception and it was not handled in the test case.
This commit fixes the problem by mocking the network manager which
mock the functionality of function which makes the sdbus call.
Change-Id: I5b60a2117a661cffa36200415ca611b85dd2fda1
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Diffstat (limited to 'network_manager.hpp')
-rw-r--r-- | network_manager.hpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/network_manager.hpp b/network_manager.hpp index 7a98f9a..a4d066c 100644 --- a/network_manager.hpp +++ b/network_manager.hpp @@ -35,9 +35,6 @@ using VLANCreateIface = details::ServerObject< } // namespace details -class TestNetworkManager; // forward declaration -class TestRtNetlink; // forward declaration - /** @class Manager * @brief OpenBMC network manager implementation. */ @@ -119,17 +116,9 @@ class Manager : public details::VLANCreateIface * @param[in] unit - systemd unit name which needs to be * restarted. */ - inline void restartSystemdUnit(const std::string& unit) - { - auto bus = sdbusplus::bus::new_default(); - auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, - SYSTEMD_INTERFACE, "RestartUnit"); + virtual void restartSystemdUnit(const std::string& unit); - method.append(unit, "replace"); - bus.call_noreply(method); - } - - private: + protected: /** @brief Persistent sdbusplus DBus bus connection. */ sdbusplus::bus::bus& bus; @@ -151,9 +140,6 @@ class Manager : public details::VLANCreateIface /** @brief Network Configuration directory. */ fs::path confDir; - - friend class TestNetworkManager; - friend class TestRtNetlink; }; } // namespace network |