summaryrefslogtreecommitdiffstats
path: root/src/lib/datasrc/tests/database_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/datasrc/tests/database_unittest.cc')
-rw-r--r--src/lib/datasrc/tests/database_unittest.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index c96a1d28a8..5f18283995 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -168,13 +168,16 @@ const char* const TEST_RECORDS[][5] = {
{"child.insecdelegation.example.org.", "DS", "3600", "", "DS 5 3 3600 "
"20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE"},
- // Broken NS
+ // Delegation NS and other ordinary type of RR coexist at the same
+ // name. This is deviant (except for some special cases like the other
+ // RR could be used for addressing the NS name), but as long as the
+ // other records are hidden behind the delegation for normal queries
+ // it's not necessarily harmful. (so "broken" may be too strong, but we
+ // keep the name since it could be in a chain of sorted names for DNSSEC
+ // processing and renaming them may have other bad effects for tests).
{"brokenns1.example.org.", "A", "3600", "", "192.0.2.1"},
{"brokenns1.example.org.", "NS", "3600", "", "ns.example.com."},
- {"brokenns2.example.org.", "NS", "3600", "", "ns.example.com."},
- {"brokenns2.example.org.", "A", "3600", "", "192.0.2.1"},
-
// Now double DNAME, to test failure mode
{"baddname.example.org.", "DNAME", "3600", "", "dname1.example.com."},
{"baddname.example.org.", "DNAME", "3600", "", "dname2.example.com."},
@@ -2202,15 +2205,23 @@ TYPED_TEST(DatabaseClientTest, findDelegation) {
ZoneFinder::FIND_DEFAULT),
DataSourceError);
- // Broken NS - it lives together with something else
- EXPECT_THROW(finder->find(isc::dns::Name("brokenns1.example.org."),
- this->qtype_,
- ZoneFinder::FIND_DEFAULT),
- DataSourceError);
- EXPECT_THROW(finder->find(isc::dns::Name("brokenns2.example.org."),
- this->qtype_,
- ZoneFinder::FIND_DEFAULT),
- DataSourceError);
+ // NS and other type coexist: deviant and not necessarily harmful.
+ // It should normally just result in DELEGATION; if GLUE_OK is specified,
+ // the other RR should be visible.
+ this->expected_rdatas_.clear();
+ this->expected_rdatas_.push_back("ns.example.com");
+ doFindTest(*finder, Name("brokenns1.example.org"), this->qtype_,
+ RRType::NS(), this->rrttl_, ZoneFinder::DELEGATION,
+ this->expected_rdatas_, this->empty_rdatas_,
+ ZoneFinder::RESULT_DEFAULT);
+
+ this->expected_rdatas_.clear();
+ this->expected_rdatas_.push_back("192.0.2.1");
+ doFindTest(*finder, Name("brokenns1.example.org"), this->qtype_,
+ this->qtype_, this->rrttl_, ZoneFinder::SUCCESS,
+ this->expected_rdatas_, this->empty_rdatas_,
+ ZoneFinder::RESULT_DEFAULT, Name("brokenns1.example.org"),
+ ZoneFinder::FIND_GLUE_OK);
}
TYPED_TEST(DatabaseClientTest, findDS) {