summaryrefslogtreecommitdiff
path: root/server/InterfaceControllerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/InterfaceControllerTest.cpp')
-rw-r--r--server/InterfaceControllerTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/InterfaceControllerTest.cpp b/server/InterfaceControllerTest.cpp
index 0cf7cfc1..fc5dce12 100644
--- a/server/InterfaceControllerTest.cpp
+++ b/server/InterfaceControllerTest.cpp
@@ -178,6 +178,19 @@ TEST_F(StablePrivacyTest, ExistingPropertyWriteFail) {
class GetIfaceListTest : public testing::Test {};
+TEST_F(GetIfaceListTest, IfaceNames) {
+ StatusOr<std::vector<std::string>> ifaceNames = InterfaceController::getIfaceNames();
+ EXPECT_EQ(ok, ifaceNames.status());
+ struct ifaddrs *ifaddr, *ifa;
+ EXPECT_EQ(0, getifaddrs(&ifaddr));
+ for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+ const auto val = std::find(
+ ifaceNames.value().begin(), ifaceNames.value().end(), ifa->ifa_name);
+ EXPECT_NE(ifaceNames.value().end(), val);
+ }
+ freeifaddrs(ifaddr);
+}
+
TEST_F(GetIfaceListTest, IfaceExist) {
StatusOr<std::map<std::string, uint32_t>> ifaceMap = InterfaceController::getIfaceList();
EXPECT_EQ(ok, ifaceMap.status());