Browse Source

[5317] Use poll() instead of run_one() in Ctrl DHCP server unit tests.

Marcin Siodelski 7 years ago
parent
commit
2688a2a886

+ 4 - 10
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc

@@ -190,17 +190,13 @@ public:
         client.reset(new UnixControlClient());
         ASSERT_TRUE(client);
 
-        // Connect and then call server's receivePacket() so it can
-        // detect the control socket connect and call the  accept handler
+        // Connect.
         ASSERT_TRUE(client->connectToServer(socket_path_));
-        ASSERT_NO_THROW(server_->receivePacket(0));
-        ASSERT_NO_THROW(getIOService()->run_one());
+        ASSERT_NO_THROW(getIOService()->poll());
 
-        // Send the command and then call server's receivePacket() so it can
-        // detect the inbound data and call the read handler
+        // Send the command.
         ASSERT_TRUE(client->sendCommand(command));
-        ASSERT_NO_THROW(server_->receivePacket(0));
-        ASSERT_NO_THROW(getIOService()->run_one());
+        ASSERT_NO_THROW(getIOService()->poll());
 
         // Read the response generated by the server. Note that getResponse
         // only fails if there an IO error or no response data was present.
@@ -209,8 +205,6 @@ public:
 
         // Now disconnect and process the close event
         client->disconnectFromServer();
-        ASSERT_NO_THROW(server_->receivePacket(0));
-//        ASSERT_NO_THROW(getIOService()->run_one());
 
         ASSERT_NO_THROW(getIOService()->poll());
     }

+ 4 - 9
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc

@@ -200,17 +200,13 @@ public:
         client.reset(new UnixControlClient());
         ASSERT_TRUE(client);
 
-        // Connect and then call server's receivePacket() so it can
-        // detect the control socket connect and call the  accept handler
+        // Connect.
         ASSERT_TRUE(client->connectToServer(socket_path_));
-        ASSERT_NO_THROW(server_->receivePacket(0));
-        ASSERT_NO_THROW(getIOService()->run_one());
+        ASSERT_NO_THROW(getIOService()->poll());
 
-        // Send the command and then call server's receivePacket() so it can
-        // detect the inbound data and call the read handler
+        // Send the command.
         ASSERT_TRUE(client->sendCommand(command));
-        ASSERT_NO_THROW(server_->receivePacket(0));
-        ASSERT_NO_THROW(getIOService()->run_one());
+        ASSERT_NO_THROW(getIOService()->poll());
 
         // Read the response generated by the server. Note that getResponse
         // only fails if there an IO error or no response data was present.
@@ -219,7 +215,6 @@ public:
 
         // Now disconnect and process the close event
         client->disconnectFromServer();
-        ASSERT_NO_THROW(server_->receivePacket(0));
 
         ASSERT_NO_THROW(getIOService()->poll());
     }