BIND 10 trac493, updated. 2a0f21d3415558e8be812e74e554e11c6cbd6270 [trac493] Add nxdomain response without soa record unit test

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Feb 28 03:37:11 UTC 2011


The branch, trac493 has been updated
       via  2a0f21d3415558e8be812e74e554e11c6cbd6270 (commit)
      from  cc7a7fb930a5300aae369665ddc882c8bbf73cb7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2a0f21d3415558e8be812e74e554e11c6cbd6270
Author: Ocean Wang <wanghaidong at cnnic.cn>
Date:   Mon Feb 28 11:36:19 2011 +0800

    [trac493] Add nxdomain response without soa record unit test

-----------------------------------------------------------------------

Summary of changes:
 src/lib/cache/tests/negative_cache_unittest.cc |   25 ++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/cache/tests/negative_cache_unittest.cc b/src/lib/cache/tests/negative_cache_unittest.cc
index ca946ba..d8c122a 100644
--- a/src/lib/cache/tests/negative_cache_unittest.cc
+++ b/src/lib/cache/tests/negative_cache_unittest.cc
@@ -88,6 +88,31 @@ TEST_F(NegativeCacheTest, testNXDOMAIN){
     // The TTL should equal to the TTL of negative response SOA record
     const RRTTL& nxdomain_ttl2 = rrset_ptr->getTTL();
     EXPECT_EQ(nxdomain_ttl2.getValue(), 86400);
+
+    // Check the normal SOA cache again
+    Message msg_example_com_soa2(Message::PARSE);
+    messageFromFile(msg_example_com_soa2, "message_example_com_soa.wire");
+    msg_example_com_soa2.makeResponse();
+    EXPECT_TRUE(cache->lookup(soa_qname, RRType::SOA(), RRClass::IN(), msg_example_com_soa2));
+
+    iter = msg_example_com_soa2.beginSection(Message::SECTION_ANSWER);
+    rrset_ptr = *iter;
+    const RRTTL& soa_ttl2 = rrset_ptr->getTTL();
+    // The TTL should equal to the TTL of SOA record in answer section
+    EXPECT_EQ(soa_ttl2.getValue(), 172800);
+}
+
+TEST_F(NegativeCacheTest, testNXDOMAINWithoutSOA){
+    // NXDOMAIN response for nonexist.example.com
+    Message msg_nxdomain(Message::PARSE);
+    messageFromFile(msg_nxdomain, "message_nxdomain_no_soa.wire");
+    cache->update(msg_nxdomain);
+
+    msg_nxdomain.makeResponse();
+
+    Name non_exist_qname("nonexist.example.com.");
+    // The message should not be cached
+    EXPECT_FALSE(cache->lookup(non_exist_qname, RRType::A(), RRClass::IN(), msg_nxdomain));
 }
 
 }




More information about the bind10-changes mailing list