Browse Source

[master] Merge branch 'trac3265'

Marcin Siodelski 11 years ago
parent
commit
3a4eb2476e
1 changed files with 14 additions and 4 deletions
  1. 14 4
      src/bin/d2/tests/dns_client_unittests.cc

+ 14 - 4
src/bin/d2/tests/dns_client_unittests.cc

@@ -263,8 +263,16 @@ public:
         ASSERT_NO_THROW(message.setRcode(Rcode(Rcode::NOERROR_CODE)));
         ASSERT_NO_THROW(message.setZone(Name("example.com"), RRClass::IN()));
 
-        // Set the response wait time to 0 so as our test is not hanging. This
-        // should cause instant timeout.
+        /// @todo The timeout value could be set to 0 to trigger timeout
+        /// instantly. However, it may lead to situations that the message sent
+        /// in one test will not be dropped by the kernel by the time, the next
+        /// test starts. This will lead to intermittent unit test errors as
+        /// described in the ticket http://bind10.isc.org/ticket/3265.
+        /// Increasing the timeout to a non-zero value mitigates this problem.
+        /// The proper way to solve this problem is to receive the packet
+        /// on our own and drop it. Such a fix will need to be applied not only
+        /// to this test but also for other tests that rely on arbitrary timeout
+        /// values.
         const int timeout = 500;
         // The doUpdate() function starts asynchronous message exchange with DNS
         // server. When message exchange is done or timeout occurs, the
@@ -324,8 +332,10 @@ public:
                                                   corrupt_response));
 
         // The socket is now ready to receive the data. Let's post some request
-        // message then.
-        const int timeout = 5;
+        // message then. Set timeout to some reasonable value to make sure that
+        // there is sufficient amount of time for the test to generate a
+        // response.
+        const int timeout = 500;
         expected_++;
         dns_client_->doUpdate(service_, IOAddress(TEST_ADDRESS), TEST_PORT,
                              message, timeout);