BIND 10 trac551, updated. 2db67df75178a2bc407417540dde75e895eb619b [trac551] Check for correct name in wildcard

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 10 12:25:05 UTC 2011


The branch, trac551 has been updated
       via  2db67df75178a2bc407417540dde75e895eb619b (commit)
       via  0da13ea71e97d62ee8cffeac9613a59f6dd07335 (commit)
      from  c95b25359f139a816f114378872bc08ab7e6aef2 (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 2db67df75178a2bc407417540dde75e895eb619b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 10 13:24:25 2011 +0100

    [trac551] Check for correct name in wildcard
    
    We want the name we asked for, not the one with * at the beginning.

commit 0da13ea71e97d62ee8cffeac9613a59f6dd07335
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 10 13:23:27 2011 +0100

    [trac551] Routine to check created RRsets
    
    The wildcard handling needs to create synthetized RRsets with different
    name. Therefore check by pointer is not OK.

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

Summary of changes:
 src/lib/datasrc/tests/memory_datasrc_unittest.cc |   36 +++++++++++++++++++---
 1 files changed, 31 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index 025214c..504a256 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -268,13 +268,18 @@ public:
      * \param answer The expected rrset, if any should be returned.
      * \param zone Check different MemoryZone object than zone_ (if NULL,
      *     uses zone_)
+     * \param check_wild_answer Checks that the answer has the same RRs, type
+     *     class and TTL as the eqxpected answer and that the name corresponds
+     *     to the one searched. It is meant for checking answers for wildcard
+     *     queries.
      */
     void findTest(const Name& name, const RRType& rrtype, Zone::Result result,
                   bool check_answer = true,
                   const ConstRRsetPtr& answer = ConstRRsetPtr(),
                   RRsetList* target = NULL,
                   MemoryZone* zone = NULL,
-                  Zone::FindOptions options = Zone::FIND_DEFAULT)
+                  Zone::FindOptions options = Zone::FIND_DEFAULT,
+                  bool check_wild_answer = false)
     {
         if (!zone) {
             zone = &zone_;
@@ -288,6 +293,28 @@ public:
                 EXPECT_EQ(result, find_result.code);
                 if (check_answer) {
                     EXPECT_EQ(answer, find_result.rrset);
+                } else if (check_wild_answer) {
+                    RdataIteratorPtr expectedIt(answer->getRdataIterator());
+                    RdataIteratorPtr gotIt(answer->getRdataIterator());
+                    while (!expectedIt->isLast() && !gotIt->isLast()) {
+                        EXPECT_EQ(0, expectedIt->getCurrent().compare(
+                            gotIt->getCurrent())) << "The RRs differ ('" <<
+                            expectedIt->getCurrent().toText() << "', '" <<
+                            gotIt->getCurrent().toText() << "')";
+                        expectedIt->next();
+                        gotIt->next();
+                    }
+                    EXPECT_TRUE(expectedIt->isLast()) <<
+                        "Result has less RRs than expected";
+                    EXPECT_TRUE(gotIt->isLast()) <<
+                        "Result has more RRs than expected";
+                    EXPECT_EQ(answer->getType(),
+                        find_result.rrset->getType());
+                    EXPECT_EQ(answer->getType(),
+                        find_result.rrset->getType());
+                    EXPECT_EQ(answer->getTTL(),
+                        find_result.rrset->getTTL());
+                    EXPECT_EQ(name, find_result.rrset->getName());
                 }
             });
     }
@@ -683,18 +710,17 @@ TEST_F(MemoryZoneTest, wildcard) {
             rr_wild_);
     }
     // Search "created" name.
-    // TODO We need to synthetize the name correctly, there'll be different rrset
     {
         SCOPED_TRACE("Search at created child");
-        findTest(Name("a.wild.example.org"), RRType::A(), Zone::SUCCESS, true,
-            rr_wild_);
+        findTest(Name("a.wild.example.org"), RRType::A(), Zone::SUCCESS, false,
+            rr_wild_, NULL, NULL, Zone::FIND_DEFAULT, true);
     }
 
     // Search another created name, this time little bit lower
     {
         SCOPED_TRACE("Search at created grand-child");
         findTest(Name("a.b.wild.example.org"), RRType::A(), Zone::SUCCESS,
-            true, rr_wild_);
+            false, rr_wild_, NULL, NULL, Zone::FIND_DEFAULT, true);
     }
 }
 




More information about the bind10-changes mailing list