From: Marcin Siodelski Date: Thu, 22 Jun 2017 10:15:40 +0000 (+0200) Subject: [5317] Use poll() instead of run_one() in Ctrl DHCP server unit tests. X-Git-Tag: trac5227_base~26^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2688a2a8861d55865f416c4189257bd8046b741b;p=thirdparty%2Fkea.git [5317] Use poll() instead of run_one() in Ctrl DHCP server unit tests. --- diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index dfc4dc2c92..cd080b07df 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/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()); } diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 481384ebe0..dc71f31d8d 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/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()); }