Browse Source

Add a unit test for NS query at a zone cut

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1319 e5f2f494-b856-4b98-b285-d166d9295462
Evan Hunt 15 years ago
parent
commit
051b1916e3

+ 31 - 2
src/lib/auth/tests/datasrc_unittest.cc

@@ -207,7 +207,7 @@ TEST_F(DataSrcTest, NxZone) {
 }
 }
 
 
 TEST_F(DataSrcTest, Wildcard) {
 TEST_F(DataSrcTest, Wildcard) {
-    readAndProcessQuery(msg, "testdata/q_wild");
+    readAndProcessQuery(msg, "testdata/q_wild_a");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
 
 
@@ -256,7 +256,7 @@ TEST_F(DataSrcTest, WildcardNodata) {
 
 
     // Check that a query for a data type not covered by the wildcard
     // Check that a query for a data type not covered by the wildcard
     // returns NOERROR
     // returns NOERROR
-    readAndProcessQuery(msg, "testdata/q_wild2");
+    readAndProcessQuery(msg, "testdata/q_wild_aaaa");
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
 }
 }
 
 
@@ -452,6 +452,35 @@ TEST_F(DataSrcTest, Delegation) {
     EXPECT_TRUE(it->isLast());
     EXPECT_TRUE(it->isLast());
 }
 }
 
 
+TEST_F(DataSrcTest, NSDelegation) {
+    readAndProcessQuery(msg, "testdata/q_subzone_ns");
+
+    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) {
 TEST_F(DataSrcTest, DS) {
     readAndProcessQuery(msg, "testdata/q_subzone_ds");
     readAndProcessQuery(msg, "testdata/q_subzone_ds");
 
 

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

@@ -0,0 +1,4 @@
+# www.subzone.example.com/NS (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 02 00 01

src/lib/auth/tests/testdata/q_wild → src/lib/auth/tests/testdata/q_wild_a


src/lib/auth/tests/testdata/q_wild2 → src/lib/auth/tests/testdata/q_wild_aaaa