]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac5190'
authorMarcin Siodelski <marcin@isc.org>
Thu, 22 Jun 2017 09:11:57 +0000 (11:11 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 22 Jun 2017 09:11:57 +0000 (11:11 +0200)
1  2 
src/bin/agent/ca_command_mgr.cc
src/bin/agent/tests/ca_command_mgr_unittests.cc

Simple merge
index 39bee3096b5133277b815f769eb7f2299522c700,99e799c5cd02b158a697a8ba149d7be03fdfe1d4..6d1890eb5a4c0300400793881abf0700c1c8a644
@@@ -224,20 -221,17 +223,20 @@@ public
                       const size_t expected_responses = 1,
                       const std::string& server_response = "{ \"result\": 0 }") {
          // Configure client side socket.
-         configureControlSocket(server_type);
+         configureControlSocket(configured_service);
          // Create server side socket.
 -        bindServerSocket(server_response);
 +        bindServerSocket(server_response, true);
  
          // The client side communication is synchronous. To be able to respond
 -        // 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 th(boost::bind(&CtrlAgentCommandMgrTest::runIO,
 -                                                 getIOService(), server_socket_,
 -                                                 expected_responses));
 +        // to this we need to run the server side socket at the same time as the
 +        // client. Running IO service in a thread guarantees that the server
 +        //responds as soon as it receives the control command.
 +        isc::util::thread::Thread th(boost::bind(&IOService::run,
 +                                                 getIOService().get()));
 +
 +
 +        // Wait for the IO service in thread to actually run.
 +        server_socket_->waitForRunning();
  
          ConstElementPtr command = createCommand("foo", service);
          ConstElementPtr answer = mgr_.handleCommand("foo", ConstElementPtr(),
@@@ -321,19 -322,7 +316,19 @@@ TEST_F(CtrlAgentCommandMgrTest, noServi
  /// Check that error is returned to the client when the server to which the
  /// command was forwarded sent an invalid message.
  TEST_F(CtrlAgentCommandMgrTest, invalidAnswer) {
-     testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp6",
+     testForward("dhcp6", "dhcp6",
 +                isc::config::CONTROL_RESULT_ERROR, -1, -1, 1,
 +                "{ \"result\": }");
 +}
 +
 +/// Check that connection is dropped if it takes too long. The test checks
 +/// client's behavior when partial JSON is returned. Client will be waiting
 +/// for the '}' and will timeout because it is never received.
 +/// @todo Currently this test is disabled because we don't have configurable
 +/// timeout value. It is hardcoded to 5 sec, which is too long for the
 +/// unit test to run.
 +TEST_F(CtrlAgentCommandMgrTest, DISABLED_connectionTimeout) {
 +    testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp6",
                  isc::config::CONTROL_RESULT_ERROR, -1, -1, 1,
                  "{ \"result\": 0");
  }
@@@ -364,9 -353,9 +359,9 @@@ TEST_F(CtrlAgentCommandMgrTest, noServe
  // value is specified.
  TEST_F(CtrlAgentCommandMgrTest, forwardListCommands) {
      // Configure client side socket.
-     configureControlSocket(CtrlAgentCfgContext::TYPE_DHCP4);
+     configureControlSocket("dhcp4");
      // Create server side socket.
 -    bindServerSocket("{ \"result\" : 3 }");
 +    bindServerSocket("{ \"result\" : 3 }", true);
  
      // The client side communication is synchronous. To be able to respond
      // to this we need to run the server side socket at the same time.