Browse Source

[master] update to make a test in master work

Jelte Jansen 14 years ago
parent
commit
ab4d484d2d

+ 13 - 5
src/lib/resolve/recursive_query.cc

@@ -254,11 +254,19 @@ private:
         current_ns_address = address;
         gettimeofday(&current_ns_qsent_time, NULL);
         ++outstanding_events_;
-        IOFetch query(protocol_, io_, question_,
-            current_ns_address.getAddress(),
-            53, buffer_, this,
-            query_timeout_);
-        io_.get_io_service().post(query);
+        if (test_server_.second != 0) {
+            IOFetch query(protocol_, io_, question_,
+                test_server_.first,
+                test_server_.second, buffer_, this,
+                query_timeout_);
+            io_.get_io_service().post(query);
+		} else {
+	        IOFetch query(protocol_, io_, question_,
+	            current_ns_address.getAddress(),
+	            53, buffer_, this,
+	            query_timeout_);
+	        io_.get_io_service().post(query);
+		}
     }
     
     // 'general' send; if we are in forwarder mode, send a query to

+ 1 - 0
src/lib/resolve/tests/Makefile.am

@@ -29,6 +29,7 @@ run_unittests_LDADD +=  $(top_builddir)/src/lib/cache/libcache.la
 run_unittests_LDADD +=  $(top_builddir)/src/lib/asiolink/libasiolink.la
 run_unittests_LDADD +=  $(top_builddir)/src/lib/resolve/libresolve.la
 run_unittests_LDADD +=  $(top_builddir)/src/lib/dns/libdns++.la
+run_unittests_LDADD +=  $(top_builddir)/src/lib/log/liblog.la
 
 endif
 

+ 5 - 2
src/lib/resolve/tests/recursive_query_unittest_2.cc

@@ -21,6 +21,7 @@
 #include <gtest/gtest.h>
 #include <boost/bind.hpp>
 
+#include <log/dummylog.h>
 
 #include <asio.hpp>
 
@@ -82,7 +83,7 @@ const char* WWW_EXAMPLE_ORG = "192.0.2.254";    ///< Address of www.example.org
 // As the test is fairly long and complex, debugging "print" statements have
 // been left in although they are disabled.  Set the following to "true" to
 // enable them.
-const bool DEBUG_PRINT = false;
+const bool DEBUG_PRINT = true;
 
 class MockResolver : public isc::resolve::ResolverInterface {
     void resolve(const QuestionPtr& question,
@@ -538,6 +539,7 @@ public:
     virtual void success(const isc::dns::MessagePtr response) {
         if (debug_) {
             cout << "ResolverCallback::success(): answer received" << endl;
+            cout << response->toText() << endl;
         }
 
         // There should be one RR each  in the question and answer sections, and
@@ -606,7 +608,8 @@ private:
 // Sets up the UDP and TCP "servers", then tries a resolution.
 
 TEST_F(RecursiveQueryTest2, Resolve) {
-
+	isc::log::denabled = true;
+	
     // Set up the UDP server and issue the first read.  The endpoint from which
     // the query is sent is put in udp_endpoint_ when the read completes, which
     // is referenced in the callback as the place to which the response is sent.