]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Multiple small improvements in the unit tests.
authorMarcin Siodelski <marcin@isc.org>
Mon, 24 Apr 2017 12:55:24 +0000 (14:55 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 24 Apr 2017 12:55:24 +0000 (14:55 +0200)
Also, the read buffer for unix socket client is extended to 64k.

src/bin/agent/ca_command_mgr.h
src/bin/agent/tests/ca_command_mgr_unittests.cc
src/lib/asiolink/testutils/test_server_unix_socket.cc

index 17b59a0666794e0c0ea0be92570d3164f6bfdb6a..d1c24fde7f23ec5b6e512cdbf79acf2173759c05 100644 (file)
@@ -110,7 +110,7 @@ private:
     CtrlAgentCommandMgr();
 
     /// @brief Buffer into which responses to forwarded commands are stored.
-    std::array<char, 8192> receive_buf_;
+    std::array<char, 65535> receive_buf_;
 
 };
 
index c70e76e09eaaa1a96f54dcab3051d17bb534f557..ef8c577dd8d730d36a5e0679c747dabba4d538fc 100644 (file)
@@ -230,14 +230,16 @@ public:
         // to this we need to run the server side socket at the same time.
         // Running IO service in a thread guarantees that the server responds
         // as soon as it receives the control command.
-        isc::util::thread::Thread(boost::bind(&CtrlAgentCommandMgrTest::runIO,
-                                              getIOService(), server_socket_,
-                                              expected_responses));
+        isc::util::thread::Thread th(boost::bind(&CtrlAgentCommandMgrTest::runIO,
+                                                 getIOService(), server_socket_,
+                                                 expected_responses));
 
         ConstElementPtr command = createCommand("foo", service);
         ConstElementPtr answer = mgr_.handleCommand("foo", ConstElementPtr(),
                                                     command);
 
+        th.wait();
+
         checkAnswer(answer, expected_result0, expected_result1, expected_result2);
     }
 
@@ -364,13 +366,15 @@ TEST_F(CtrlAgentCommandMgrTest, forwardListCommands) {
     // to this we need to run the server side socket at the same time.
     // Running IO service in a thread guarantees that the server responds
     // as soon as it receives the control command.
-    isc::util::thread::Thread(boost::bind(&CtrlAgentCommandMgrTest::runIO,
-                                          getIOService(), server_socket_, 1));
+    isc::util::thread::Thread th(boost::bind(&CtrlAgentCommandMgrTest::runIO,
+                                             getIOService(), server_socket_, 1));
 
     ConstElementPtr command = createCommand("list-commands", "dhcp4");
     ConstElementPtr answer = mgr_.handleCommand("list-commands", ConstElementPtr(),
                                                 command);
 
+    th.wait();
+
     // Answer of 3 is specific to the stub response we send when the
     // command is forwarded. So having this value returned means that
     // the command was forwarded as expected.
index ab374cc062b09af40a8a2469b8227dc623812498..63261a29f1515d5b20f16c477065352f527f83b3 100644 (file)
@@ -225,7 +225,11 @@ TestServerUnixSocket::bindServerSocket() {
 }
 
 void
-TestServerUnixSocket::acceptHandler(const boost::system::error_code&) {
+TestServerUnixSocket::acceptHandler(const boost::system::error_code& ec) {
+    if (ec) {
+        return;
+    }
+
     connection_pool_->start(custom_response_);
     accept();
 }