Browse Source

add a unit test to explicitly cover the case of an ANY query at a zone cut

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1328 e5f2f494-b856-4b98-b285-d166d9295462
Evan Hunt 15 years ago
parent
commit
a3e8eb8a51
2 changed files with 37 additions and 0 deletions
  1. 33 0
      src/lib/auth/tests/datasrc_unittest.cc
  2. 4 0
      src/lib/auth/tests/testdata/q_subzone_any

+ 33 - 0
src/lib/auth/tests/datasrc_unittest.cc

@@ -481,6 +481,39 @@ TEST_F(DataSrcTest, NSDelegation) {
     it->next();
     EXPECT_TRUE(it->isLast());
 }
+
+TEST_F(DataSrcTest, ANYDelegation) {
+    // An ANY query at a zone cut should behave the same as any other
+    // delegation
+    readAndProcessQuery(msg, "testdata/q_subzone_any");
+
+    headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
+
+    RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
+    RRsetPtr rrset = *rit;
+    EXPECT_EQ(Name("subzone.example.com."), rrset->getName());
+    EXPECT_EQ(RRType::NS(), rrset->getType());
+    EXPECT_EQ(RRClass::IN(), rrset->getClass());
+
+    RdataIteratorPtr it = rrset->getRdataIterator();
+    it->first();
+    EXPECT_EQ("ns1.subzone.example.com.", it->getCurrent().toText());
+    it->next();
+    EXPECT_FALSE(it->isLast());
+
+    rit = msg.beginSection(Section::ADDITIONAL());
+    rrset = *rit;
+    EXPECT_EQ(Name("ns1.subzone.example.com"), rrset->getName());
+    EXPECT_EQ(RRType::A(), rrset->getType());
+    EXPECT_EQ(RRClass::IN(), rrset->getClass());
+
+    it = rrset->getRdataIterator();
+    it->first();
+    EXPECT_EQ("192.168.3.1", it->getCurrent().toText());
+    it->next();
+    EXPECT_TRUE(it->isLast());
+}
+
 TEST_F(DataSrcTest, DS) {
     readAndProcessQuery(msg, "testdata/q_subzone_ds");
 

+ 4 - 0
src/lib/auth/tests/testdata/q_subzone_any

@@ -0,0 +1,4 @@
+# www.subzone.example.com/A (delegation to non-local zone)
+  00 7c 01 00 00 01 00 00 00 00 00 00 03 77 77 77
+  07 73 75 62 7a 6f 6e 65 07 65 78 61 6d 70 6c 65
+  03 63 6f 6d 00 00 ff 00 01