[svn] commit: r4072 - /branches/trac458/src/bin/auth/tests/query_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 29 09:09:08 UTC 2010


Author: vorner
Date: Wed Dec 29 09:09:08 2010
New Revision: 4072

Log:
Improve the test

Modified:
    branches/trac458/src/bin/auth/tests/query_unittest.cc

Modified: branches/trac458/src/bin/auth/tests/query_unittest.cc
==============================================================================
--- branches/trac458/src/bin/auth/tests/query_unittest.cc (original)
+++ branches/trac458/src/bin/auth/tests/query_unittest.cc Wed Dec 29 09:09:08 2010
@@ -49,6 +49,8 @@
     {
         mx_rrset_->addRdata(isc::dns::rdata::generic::MX(10,
             Name("www.example.com")));
+        mx_rrset_->addRdata(isc::dns::rdata::generic::MX(20,
+            Name("mailer.example.org")));
     }
     virtual const isc::dns::Name& getOrigin() const;
     virtual const isc::dns::RRClass& getClass() const;
@@ -147,6 +149,12 @@
     EXPECT_EQ(Rcode::REFUSED(), response.getRcode());
 }
 
+/*
+ * Test MX additional processing.
+ *
+ * The MX RRset has two RRs, one pointing to a known domain with
+ * A record, other to unknown out of zone one.
+ */
 TEST_F(QueryTest, MX) {
     memory_datasrc.addZone(ZonePtr(new MockZone()));
     Name qname("mx.example.com");
@@ -157,6 +165,16 @@
         Name("mx.example.com"), RRClass::IN(), RRType::MX()));
     EXPECT_TRUE(response.hasRRset(Message::SECTION_ADDITIONAL,
         Name("www.example.com"), RRClass::IN(), RRType::A()));
+    // In fact, the MX RRset mentions two names, but we don't know anything
+    // about the other, so we have just 1 additional rrset
+    size_t additional_count(0);
+    for (SectionIterator<RRsetPtr> ai(response.beginSection(
+        Message::SECTION_ANSWER)); ai != response.endSection(
+        Message::SECTION_ANSWER); ++ ai)
+    {
+        additional_count ++;
+    }
+    EXPECT_EQ(1, additional_count);
 }
 
 }




More information about the bind10-changes mailing list