Test: Add test cases for NTP
Resolves openbmc/openbmc#2106
Change-Id: I93bbbb1178dc47fa94f98719185630020e00edda
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
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 @@
{
setConfDir();
-
}
void setConfDir()
@@ -168,5 +169,16 @@
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