diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-08-23 16:53:52 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@in.ibm.com> | 2017-10-11 18:17:18 +0530 |
commit | c9645fe5c874930445bca6ba51ac9daee916c99b (patch) | |
tree | cb57ecc65947b151a19bc25beef6c349be4c5b4c | |
parent | 497c0c9f28b33b48a485a0ab319896ac758994d4 (diff) | |
download | phosphor-networkd-c9645fe5c874930445bca6ba51ac9daee916c99b.tar.gz phosphor-networkd-c9645fe5c874930445bca6ba51ac9daee916c99b.zip |
Test: Add test cases for NTP
Resolves openbmc/openbmc#2106
Change-Id: I93bbbb1178dc47fa94f98719185630020e00edda
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
-rw-r--r-- | test/test_ethernet_interface.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp index 8d1913e..edc12fb 100644 --- a/test/test_ethernet_interface.cpp +++ b/test/test_ethernet_interface.cpp @@ -1,3 +1,4 @@ +#include "config_parser.hpp" #include "network_manager.hpp" #include "mock_syscall.hpp" #include "ipaddress.hpp" @@ -11,6 +12,7 @@ #include <stdlib.h> #include <exception> +#include <fstream> namespace phosphor { @@ -32,7 +34,6 @@ class TestEthernetInterface : public testing::Test { setConfDir(); - } void setConfDir() @@ -168,5 +169,16 @@ TEST_F(TestEthernetInterface, CheckObjectPath) gateway)); } +TEST_F(TestEthernetInterface, addNTPServers) +{ + ServerList servers = {"10.1.1.1","10.2.2.2","10.3.3.3"}; + interface.nTPServers(servers); + fs::path filePath = confDir; + filePath /= "00-bmc-test0.network"; + config::Parser parser(filePath.string()); + auto values = parser.getValues("Network", "NTP"); + EXPECT_EQ(servers , values); +} + }// namespce network }// namespace phosphor |