summaryrefslogtreecommitdiffstats
path: root/network_manager.cpp
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@linux.vnet.ibm.com>2018-11-28 18:40:16 +0530
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2018-11-30 20:42:02 +0530
commit35297177b81061c3ac6658412c6306556849790a (patch)
tree9a2a63e74cf4cb2930bca7587fef91f855e8aa0e /network_manager.cpp
parent450b346910a7bcf9abde55d76693539a83bf33f7 (diff)
downloadphosphor-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.cpp')
-rw-r--r--network_manager.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/network_manager.cpp b/network_manager.cpp
index 35a9fc8..bd1244d 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
@@ -212,5 +212,22 @@ void Manager::restartTimers()
}
}
+void Manager::restartSystemdUnit(const std::string& unit)
+{
+ try
+ {
+ auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+ SYSTEMD_INTERFACE, "RestartUnit");
+ method.append(unit.c_str(), "replace");
+ bus.call_noreply(method);
+ }
+ catch (const sdbusplus::exception::SdBusError& ex)
+ {
+ log<level::ERR>("Failed to restart nslcd service",
+ entry("ERR=%s", ex.what()));
+ elog<InternalFailure>();
+ }
+}
+
} // namespace network
} // namespace phosphor
OpenPOWER on IntegriCloud