Browse Source

add unitest for notify

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac221@2220 e5f2f494-b856-4b98-b285-d166d9295462
Han Feng 15 years ago
parent
commit
2e4f58b9dd

+ 1 - 1
src/bin/auth/auth_srv.cc

@@ -348,7 +348,7 @@ AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
         axfr_client_.sendXfroutRequestInfo(io_message.getSocket().getNative(),
                                          io_message.getData(),
                                          io_message.getDataSize());
-    } catch (const XfroutError& err) { // XXX: avoid catch-all catch!!
+    } catch (const XfroutError& err) { 
         if (is_xfrin_connection_established_) {
             axfr_client_.disconnect();
             is_xfrin_connection_established_ = false;

+ 14 - 1
src/bin/auth/tests/auth_srv_unittest.cc

@@ -128,7 +128,9 @@ headerCheck(const Message& message, const qid_t qid, const Rcode& rcode,
 TEST_F(AuthSrvTest, unsupportedRequest) {
     for (unsigned int i = 1; i < 16; ++i) {
         // set Opcode to 'i', which iterators over all possible codes except
-        // the standard query (0)
+        // the standard query (0) and notify(4)
+        if (i == 4)
+            continue;
         createDataFromFile("simplequery_fromWire");
         data[2] = ((i << 3) & 0xff);
 
@@ -242,6 +244,17 @@ TEST_F(AuthSrvTest, ednsBadVers) {
     EXPECT_FALSE(parse_message.isDNSSECSupported());
 }
 
+// notify-in teset.
+TEST_F(AuthSrvTest, notifyInTest) {
+    createDataFromFile("notifyin_fromwire");
+    parse_message.clear(Message::PARSE);
+    EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
+                                              response_renderer));
+    headerCheck(parse_message, default_qid, Rcode::NOERROR(), Opcode::NOTIFY().getCode(), QR_FLAG,
+                    1, 0, 0, 0);
+}
+
+
 void
 updateConfig(AuthSrv* server, const char* const dbfile,
              const bool expect_success)

+ 13 - 0
src/bin/auth/tests/testdata/notifyin_fromwire

@@ -0,0 +1,13 @@
+###
+### This data file was auto-generated from simplequery_fromWire.spec
+###
+
+# Header Section
+# ID=4149 QR=Query Opcode=NOTIFY(4) Rcode=NOERROR(0)
+1035 2400
+# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
+0001 0000 0000 0000
+
+# Question Section
+# QNAME=example.com. QTYPE=SOA(6) QCLASS=IN(1)
+076578616d706c6503636f6d00 0006 0001