Parcourir la source

[2108] Test when RRSIG doesn't match the name it is supposed to cover

Mukund Sivaraman il y a 12 ans
Parent
commit
1af7d120c3

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

@@ -136,6 +136,14 @@ TEST_F(MemoryClientTest, loadRRSIGFollowsNothing) {
     // Teardown checks for memory segment leaks
 }
 
+TEST_F(MemoryClientTest, loadRRSIGNameUnmatched) {
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR
+                               "/example.org-rrsig-name-unmatched.zone"),
+                 InMemoryClient::AddError);
+    // Teardown checks for memory segment leaks
+}
+
 TEST_F(MemoryClientTest, getZoneCount) {
     EXPECT_EQ(0, client_->getZoneCount());
     client_->load(Name("example.org"), TEST_DATA_DIR "/example.org-empty.zone");

+ 1 - 0
src/lib/datasrc/memory/tests/testdata/Makefile.am

@@ -5,3 +5,4 @@ EXTRA_DIST += example.org-empty.zone
 EXTRA_DIST += example.org-broken1.zone
 EXTRA_DIST += example.org-broken2.zone
 EXTRA_DIST += example.org-rrsig-follows-nothing.zone
+EXTRA_DIST += example.org-rrsig-name-unmatched.zone

+ 6 - 0
src/lib/datasrc/memory/tests/testdata/example.org-rrsig-name-unmatched.zone

@@ -0,0 +1,6 @@
+;; test zone file used for ZoneFinderContext tests.
+;; RRSIGs are (obviouslly) faked ones for testing.
+
+example.org. 3600 IN SOA	ns1.example.org. bugs.x.w.example.org. 70 3600 300 3600000 3600
+ns1.example.org.		      3600 IN A		192.0.2.1
+ns2.example.org.		      3600 IN RRSIG	A 7 3 3600 20150420235959 20051021000000 40430 example.org. FAKEFAKE