test/rtnetlink_server: Remove
There is now minimal interesting code in this object, with all of the
testability pushed to netlink parsing code and network_manager.
Change-Id: I3be1571898e430df30463d8c5dc3d7785fa23051
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/meson.build b/test/meson.build
index 22bbfe3..1b96586 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -49,7 +49,6 @@
'netlink',
'network_manager',
'rtnetlink',
- #'rtnetlink_server',
'system_queries',
'types',
'util',
diff --git a/test/test_rtnetlink_server.cpp b/test/test_rtnetlink_server.cpp
deleted file mode 100644
index b11100f..0000000
--- a/test/test_rtnetlink_server.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "mock_network_manager.hpp"
-#include "mock_syscall.hpp"
-#include "rtnetlink_server.hpp"
-#include "types.hpp"
-
-#include <linux/rtnetlink.h>
-#include <net/if.h>
-
-#include <chrono>
-#include <functional>
-#include <sdbusplus/bus.hpp>
-#include <sdeventplus/event.hpp>
-#include <testutil.hpp>
-
-#include <gtest/gtest.h>
-
-namespace phosphor
-{
-
-namespace network
-{
-sdbusplus::bus_t bus(sdbusplus::bus::new_default());
-extern std::unique_ptr<MockManager> manager;
-extern std::unique_ptr<Timer> refreshObjectTimer;
-EventPtr eventPtr = nullptr;
-
-class TestRtNetlink : public TestWithTmp
-{
-
- public:
- std::optional<rtnetlink::Server> svr;
-
- TestRtNetlink()
- {
- manager = std::make_unique<MockManager>(bus, "/xyz/openbmc_test/bcd",
- CaseTmpDir());
- sd_event* events;
- sd_event_default(&events);
- eventPtr.reset(events);
- events = nullptr;
- initializeTimers();
- createNetLinkSocket();
- bus.attach_event(eventPtr.get(), SD_EVENT_PRIORITY_NORMAL);
- svr.emplace(eventPtr);
- }
-
- void createNetLinkSocket()
- {
- // RtnetLink socket
- auto fd = socket(PF_NETLINK, SOCK_RAW | SOCK_NONBLOCK, NETLINK_ROUTE);
- smartSock.set(fd);
- }
-};
-
-TEST_F(TestRtNetlink, WithSingleInterface)
-{
- using namespace std::chrono;
- mock_clear();
- // Adds the following ip in the getifaddrs list.
- mock_addIF("igb5", /*idx=*/6);
- mock_addIP("igb5", "127.0.0.1", "255.255.255.128");
- constexpr auto BUFSIZE = 4096;
- std::array<char, BUFSIZE> msgBuf = {0};
-
- // point the header and the msg structure pointers into the buffer.
- auto nlMsg = reinterpret_cast<nlmsghdr*>(msgBuf.data());
- // Length of message
- nlMsg->nlmsg_len = NLMSG_LENGTH(sizeof(rtmsg));
- nlMsg->nlmsg_type = RTM_GETADDR;
- nlMsg->nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST;
- nlMsg->nlmsg_seq = 0;
- nlMsg->nlmsg_pid = getpid();
-
- EXPECT_EQ(false, manager->hasInterface("igb5"));
- // Send the request
- send(svr->getSock(), nlMsg, nlMsg->nlmsg_len, 0);
-
- int i = 3;
- while (i--)
- {
- // wait for timer to expire
- std::this_thread::sleep_for(std::chrono::milliseconds(refreshTimeout));
- sd_event_run(eventPtr.get(), 10);
- };
-
- EXPECT_EQ(true, manager->hasInterface("igb5"));
-}
-
-} // namespace network
-} // namespace phosphor