Browse Source

[2108] Add CNAME+other tests (which should throw)

Mukund Sivaraman 12 years ago
parent
commit
e898d07a45

+ 15 - 0
src/lib/datasrc/memory/tests/memory_client_unittest.cc

@@ -335,6 +335,21 @@ TEST_F(MemoryClientTest, loadNSEC3WithMoreLabelsThrows) {
     // Teardown checks for memory segment leaks
 }
 
+TEST_F(MemoryClientTest, loadCNAMEAndNotNSECThrows) {
+    // CNAME and not NSEC should throw
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR
+                               "/example.org-cname-and-not-nsec-1.zone"),
+                 InMemoryClient::AddError);
+
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR
+                               "/example.org-cname-and-not-nsec-2.zone"),
+                 InMemoryClient::AddError);
+
+    // Teardown checks for memory segment leaks
+}
+
 TEST_F(MemoryClientTest, loadRRSIGFollowsNothing) {
     EXPECT_THROW(client_->load(Name("example.org"),
                                TEST_DATA_DIR

+ 3 - 2
src/lib/datasrc/memory/tests/testdata/Makefile.am

@@ -21,5 +21,6 @@ EXTRA_DIST += example.org-out-of-zone.zone
 EXTRA_DIST += example.org-wildcard-ns.zone
 EXTRA_DIST += example.org-wildcard-dname.zone
 EXTRA_DIST += example.org-wildcard-nsec3.zone
-EXTRA_DIST += example.org-nsec3-fewer-labels.zone
-EXTRA_DIST += example.org-nsec3-more-labels.zone
+EXTRA_DIST += example.org-nsec3-fewer-labels.zone example.org-nsec3-more-labels.zone
+EXTRA_DIST += example.org-cname-and-not-nsec-1.zone
+EXTRA_DIST += example.org-cname-and-not-nsec-2.zone

+ 4 - 0
src/lib/datasrc/memory/tests/testdata/example.org-cname-and-not-nsec-1.zone

@@ -0,0 +1,4 @@
+;; NSEC3 names with labels != (origin_labels + 1)
+example.org.				      86400 IN SOA	ns.example.org. ns.example.org. 2012091009 7200 3600 2592000 1200
+a.example.org.				      7200  IN A	192.168.0.1
+a.example.org.				      3600  IN CNAME	foo.example.com.

+ 4 - 0
src/lib/datasrc/memory/tests/testdata/example.org-cname-and-not-nsec-2.zone

@@ -0,0 +1,4 @@
+;; NSEC3 names with labels != (origin_labels + 1)
+example.org.				      86400 IN SOA	ns.example.org. ns.example.org. 2012091007 7200 3600 2592000 1200
+a.example.org.				      3600  IN CNAME	foo.example.com.
+a.example.org.				      7200  IN A	192.168.0.1