BIND 10 trac1577, updated. 4108ca766cb9bce434bfbb786436b7c08adb87a4 [1577] Logging messages fixes
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Apr 14 15:08:47 UTC 2012
The branch, trac1577 has been updated
via 4108ca766cb9bce434bfbb786436b7c08adb87a4 (commit)
via de9ccf5df44c42526b2cd8e7f078d6073729c35a (commit)
from c47c4c3541a5a9ed7a77f47610d8f14c29295969 (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 4108ca766cb9bce434bfbb786436b7c08adb87a4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Apr 14 16:51:44 2012 +0200
[1577] Logging messages fixes
One missing placeholder and one explanation in the text.
commit de9ccf5df44c42526b2cd8e7f078d6073729c35a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Apr 14 16:49:00 2012 +0200
[1577] Share some test code
As it had two copies (one in in-memory tests and one in database ones),
it can be moved to a separate function.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/datasrc_messages.mes | 4 +-
src/lib/datasrc/tests/database_unittest.cc | 81 +---------------------
src/lib/datasrc/tests/faked_nsec3.cc | 80 +++++++++++++++++++++
src/lib/datasrc/tests/faked_nsec3.h | 6 ++
src/lib/datasrc/tests/memory_datasrc_unittest.cc | 66 +-----------------
5 files changed, 92 insertions(+), 145 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index 88cf185..4b61433 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -75,7 +75,7 @@ The datasource tried to provide an NSEC proof that the named domain does not
exist, but the database backend doesn't support DNSSEC. No proof is included
in the answer as a result.
-% DATASRC_DATABASE_FINDNSEC3 Looking for NSEC3 for %1 in % mode
+% DATASRC_DATABASE_FINDNSEC3 Looking for NSEC3 for %1 in %2 mode
Debug information. A search in an database data source for NSEC3 that
matches or covers the given name is being started.
@@ -97,7 +97,7 @@ NSEC3 name space. When the shown label count is smaller than that of the
shown name, the search tries the superdomain name that share the shown
(higher) label count of the shown name (e.g., for
www.example.com. with shown label count of 3, example.com. is being
-tried).
+tried, as "." is 1 label long).
% DATASRC_DATABASE_FINDNSEC3_TRYHASH_PREV looking for previous NSEC3 for %1 at label count %2 (hash %3)
Debug information. An exact match on hash (see
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 1f346bc..980ff8f 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -3576,8 +3576,7 @@ TEST_F(MockDatabaseClientTest, journalWithBadData) {
second->getNextDiff(), DataSourceError);
}
-/// Let us test a little bit of NSEC3. This is borrowed from the in-memory tests
-/// Maybe unify the code a little bit somehow?
+/// Let us test a little bit of NSEC3.
TEST_F(MockDatabaseClientTest, findNSEC3) {
// Set up the faked hash calculator.
setNSEC3HashCreator(&test_nsec3_hash_creator_);
@@ -3594,82 +3593,8 @@ TEST_F(MockDatabaseClientTest, findNSEC3) {
// And enable NSEC3 in the zone.
this->current_accessor_->enableNSEC3();
- // Parameter validation: the query name must be in or below the zone
- EXPECT_THROW(finder->findNSEC3(Name("example.com"), false), OutOfZone);
- EXPECT_THROW(finder->findNSEC3(Name("org"), true), OutOfZone);
-
- Name origin("example.org");
- const string apex_nsec3_text = string(apex_hash) + ".example.org." +
- string(nsec3_common);
- const string ns1_nsec3_text = string(ns1_hash) + ".example.org." +
- string(nsec3_common);
- const string w_nsec3_text = string(w_hash) + ".example.org." +
- string(nsec3_common);
- const string zzz_nsec3_text = string(zzz_hash) + ".example.org." +
- string(nsec3_common);
-
- // Apex name. It should have a matching NSEC3.
- {
- SCOPED_TRACE("apex, non recursive mode");
- findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text, "",
- finder->findNSEC3(origin, false));
- }
-
- // Recursive mode doesn't change the result in this case.
- {
- SCOPED_TRACE("apex, recursive mode");
- findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text, "",
- finder->findNSEC3(origin, true));
- }
-
- // Non existent name (in the NSEC3 namespace -- the findNSEC3 does
- // not look into the normal data). Disabling recursion, a covering
- // NSEC3 should be returned.
- const Name www_name("www.example.org");
- {
- SCOPED_TRACE("non existent name, non recursive mode");
- findNSEC3Check(false, www_name.getLabelCount(), apex_nsec3_text, "",
- finder->findNSEC3(www_name, false));
- }
-
- // Non existent name. The closest provable encloser is the apex,
- // and next closer is the query name itself (which NSEC3 for ns1
- // covers)
- // H(ns1) = 2T... < H(xxx) = Q0... < H(zzz) = R5...
- {
- SCOPED_TRACE("non existent name, recursive mode");
- findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text,
- ns1_nsec3_text,
- finder->findNSEC3(Name("xxx.example.org"), true));
- }
-
- // Similar to the previous case, but next closer name is different
- // from the query name. The closet encloser is w.example.org, and
- // next closer is y.w.example.org.
- // H(ns1) = 2T.. < H(y.w) = K8.. < H(zzz) = R5
- {
- SCOPED_TRACE("non existent name, non qname next closer");
- findNSEC3Check(true, Name("w.example.org").getLabelCount(),
- w_nsec3_text, ns1_nsec3_text,
- finder->findNSEC3(Name("x.y.w.example.org"),
- true));
- }
-
- // In the rest of test we check hash comparison for wrap around cases.
- {
- SCOPED_TRACE("very small hash");
- const Name smallest_name("smallest.example.org");
- findNSEC3Check(false, smallest_name.getLabelCount(),
- zzz_nsec3_text, "",
- finder->findNSEC3(smallest_name, false));
- }
- {
- SCOPED_TRACE("very large hash");
- const Name largest_name("largest.example.org");
- findNSEC3Check(false, largest_name.getLabelCount(),
- zzz_nsec3_text, "",
- finder->findNSEC3(largest_name, false));
- }
+ // The rest is in the function, it is shared with in-memory tests
+ performNSEC3Test(*finder);
}
}
diff --git a/src/lib/datasrc/tests/faked_nsec3.cc b/src/lib/datasrc/tests/faked_nsec3.cc
index da210af..4ca22a5 100644
--- a/src/lib/datasrc/tests/faked_nsec3.cc
+++ b/src/lib/datasrc/tests/faked_nsec3.cc
@@ -111,6 +111,86 @@ findNSEC3Check(bool expected_matched, uint8_t expected_labels,
}
}
+void
+performNSEC3Test(ZoneFinder &finder) {
+ // Parameter validation: the query name must be in or below the zone
+ EXPECT_THROW(finder.findNSEC3(Name("example.com"), false), OutOfZone);
+ EXPECT_THROW(finder.findNSEC3(Name("org"), true), OutOfZone);
+
+ Name origin("example.org");
+ const string apex_nsec3_text = string(apex_hash) + ".example.org." +
+ string(nsec3_common);
+ const string ns1_nsec3_text = string(ns1_hash) + ".example.org." +
+ string(nsec3_common);
+ const string w_nsec3_text = string(w_hash) + ".example.org." +
+ string(nsec3_common);
+ const string zzz_nsec3_text = string(zzz_hash) + ".example.org." +
+ string(nsec3_common);
+
+ // Apex name. It should have a matching NSEC3.
+ {
+ SCOPED_TRACE("apex, non recursive mode");
+ findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text, "",
+ finder.findNSEC3(origin, false));
+ }
+
+ // Recursive mode doesn't change the result in this case.
+ {
+ SCOPED_TRACE("apex, recursive mode");
+ findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text, "",
+ finder.findNSEC3(origin, true));
+ }
+
+ // Non existent name (in the NSEC3 namespace -- the findNSEC3 does
+ // not look into the normal data). Disabling recursion, a covering
+ // NSEC3 should be returned.
+ const Name www_name("www.example.org");
+ {
+ SCOPED_TRACE("non existent name, non recursive mode");
+ findNSEC3Check(false, www_name.getLabelCount(), apex_nsec3_text, "",
+ finder.findNSEC3(www_name, false));
+ }
+
+ // Non existent name. The closest provable encloser is the apex,
+ // and next closer is the query name itself (which NSEC3 for ns1
+ // covers)
+ // H(ns1) = 2T... < H(xxx) = Q0... < H(zzz) = R5...
+ {
+ SCOPED_TRACE("non existent name, recursive mode");
+ findNSEC3Check(true, origin.getLabelCount(), apex_nsec3_text,
+ ns1_nsec3_text,
+ finder.findNSEC3(Name("xxx.example.org"), true));
+ }
+
+ // Similar to the previous case, but next closer name is different
+ // from the query name. The closet encloser is w.example.org, and
+ // next closer is y.w.example.org.
+ // H(ns1) = 2T.. < H(y.w) = K8.. < H(zzz) = R5
+ {
+ SCOPED_TRACE("non existent name, non qname next closer");
+ findNSEC3Check(true, Name("w.example.org").getLabelCount(),
+ w_nsec3_text, ns1_nsec3_text,
+ finder.findNSEC3(Name("x.y.w.example.org"),
+ true));
+ }
+
+ // In the rest of test we check hash comparison for wrap around cases.
+ {
+ SCOPED_TRACE("very small hash");
+ const Name smallest_name("smallest.example.org");
+ findNSEC3Check(false, smallest_name.getLabelCount(),
+ zzz_nsec3_text, "",
+ finder.findNSEC3(smallest_name, false));
+ }
+ {
+ SCOPED_TRACE("very large hash");
+ const Name largest_name("largest.example.org");
+ findNSEC3Check(false, largest_name.getLabelCount(),
+ zzz_nsec3_text, "",
+ finder.findNSEC3(largest_name, false));
+ }
+}
+
}
}
}
diff --git a/src/lib/datasrc/tests/faked_nsec3.h b/src/lib/datasrc/tests/faked_nsec3.h
index a7352f7..51b4059 100644
--- a/src/lib/datasrc/tests/faked_nsec3.h
+++ b/src/lib/datasrc/tests/faked_nsec3.h
@@ -66,6 +66,7 @@ public:
const;
};
+// Check the result against expected values. It directly calls EXPECT_ macros
void
findNSEC3Check(bool expected_matched, uint8_t expected_labels,
const std::string& expected_closest,
@@ -73,6 +74,11 @@ findNSEC3Check(bool expected_matched, uint8_t expected_labels,
const isc::datasrc::ZoneFinder::FindNSEC3Result& result,
bool expected_sig = false);
+// Perform the shared part of NSEC3 test (shared between in-memory and database
+// tests).
+void
+performNSEC3Test(ZoneFinder &finder);
+
}
}
}
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index 4403ba3..87fa24f 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -1859,71 +1859,7 @@ TEST_F(InMemoryZoneFinderTest, findNSEC3) {
string(nsec3_common);
EXPECT_EQ(result::SUCCESS, zone_finder_.add(textToRRset(zzz_nsec3_text)));
- // Parameter validation: the query name must be in or below the zone
- EXPECT_THROW(zone_finder_.findNSEC3(Name("example.com"), false), OutOfZone);
- EXPECT_THROW(zone_finder_.findNSEC3(Name("org"), true), OutOfZone);
-
- // Apex name. It should have a matching NSEC3.
- {
- SCOPED_TRACE("apex, non recursive mode");
- findNSEC3Check(true, origin_.getLabelCount(), apex_nsec3_text, "",
- zone_finder_.findNSEC3(origin_, false));
- }
-
- // Recursive mode doesn't change the result in this case.
- {
- SCOPED_TRACE("apex, recursive mode");
- findNSEC3Check(true, origin_.getLabelCount(), apex_nsec3_text, "",
- zone_finder_.findNSEC3(origin_, true));
- }
-
- // Non existent name. Disabling recursion, a covering NSEC3 should be
- // returned.
- const Name www_name("www.example.org");
- {
- SCOPED_TRACE("non existent name, non recursive mode");
- findNSEC3Check(false, www_name.getLabelCount(), apex_nsec3_text, "",
- zone_finder_.findNSEC3(www_name, false));
- }
-
- // Non existent name. The closest provable encloser is the apex,
- // and next closer is the query name itself (which NSEC3 for ns1
- // covers)
- // H(ns1) = 2T... < H(xxx) = Q0... < H(zzz) = R5...
- {
- SCOPED_TRACE("non existent name, recursive mode");
- findNSEC3Check(true, origin_.getLabelCount(), apex_nsec3_text,
- ns1_nsec3_text,
- zone_finder_.findNSEC3(Name("xxx.example.org"), true));
- }
-
- // Similar to the previous case, but next closer name is different
- // from the query name. The closet encloser is w.example.org, and
- // next closer is y.w.example.org.
- // H(ns1) = 2T.. < H(y.w) = K8.. < H(zzz) = R5
- {
- SCOPED_TRACE("non existent name, non qname next closer");
- findNSEC3Check(true, Name("w.example.org").getLabelCount(),
- w_nsec3_text, ns1_nsec3_text,
- zone_finder_.findNSEC3(Name("x.y.w.example.org"),
- true));
- }
-
- // In the rest of test we check hash comparison for wrap around cases.
- {
- SCOPED_TRACE("very small hash");
- const Name smallest_name("smallest.example.org");
- findNSEC3Check(false, smallest_name.getLabelCount(),
- zzz_nsec3_text, "",
- zone_finder_.findNSEC3(smallest_name, false));
- }
- {
- SCOPED_TRACE("very large hash");
- const Name largest_name("largest.example.org");
- findNSEC3Check(false, largest_name.getLabelCount(),
- zzz_nsec3_text, "",
- zone_finder_.findNSEC3(largest_name, false));
- }
+ performNSEC3Test(zone_finder_);
}
TEST_F(InMemoryZoneFinderTest, findNSEC3ForBadZone) {
More information about the bind10-changes
mailing list