test_rtnetlink: Improve exception handling by not handling them

All the test was doing was verifying that an exception hadn't occurred.
The test would fail if one had, so we're better off just not doing the
dance.

Change-Id: Iff7d9e4947e86b24f4cf99ddbac3e9c42e63f1d3
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/test/test_rtnetlink.cpp b/test/test_rtnetlink.cpp
index 77b771a..71e5443 100644
--- a/test/test_rtnetlink.cpp
+++ b/test/test_rtnetlink.cpp
@@ -102,45 +102,36 @@
 
 TEST_F(TestRtNetlink, WithSingleInterface)
 {
-    bool caughtException = false;
     using namespace std::chrono;
-    try
+    // Adds the following ip in the getifaddrs list.
+    mock_addIP("igb5", "127.0.0.1", "255.255.255.128",
+               IFF_UP | IFF_RUNNING);
+    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, isInterfaceAdded("igb5"));
+    // Send the request
+    send(smartSock(), nlMsg, nlMsg->nlmsg_len, 0);
+
+    int i = 2;
+    while (i--)
     {
-        // Adds the following ip in the getifaddrs list.
-        mock_addIP("igb5", "127.0.0.1", "255.255.255.128",
-                   IFF_UP | IFF_RUNNING);
-        constexpr auto BUFSIZE = 4096;
-        std::array<char, BUFSIZE> msgBuf = {0};
+        //wait for timer to expire
+        std::this_thread::sleep_for(
+            std::chrono::milliseconds(refreshTimeout));
+        sd_event_run(eventPtr.get(), 10);
+    };
 
-        // 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, isInterfaceAdded("igb5"));
-        // Send the request
-        send(smartSock(), nlMsg, nlMsg->nlmsg_len, 0);
-
-        int i = 2;
-        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, isInterfaceAdded("igb5"));
-    }
-    catch (std::exception& e)
-    {
-        caughtException = true;
-    }
-    EXPECT_EQ(false, caughtException);
+    EXPECT_EQ(true, isInterfaceAdded("igb5"));
 }
 
 }// namespce network