]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2178] add another correct zone to the test
authorJelte Jansen <jelte@isc.org>
Wed, 22 Aug 2012 08:44:09 +0000 (10:44 +0200)
committerJelte Jansen <jelte@isc.org>
Wed, 22 Aug 2012 08:44:09 +0000 (10:44 +0200)
src/lib/datasrc/tests/client_list_unittest.cc
src/lib/datasrc/tests/testdata/example.com.flattened [new file with mode: 0644]

index 8b1d4746fe1903529ef27369ae995633a9051575..fc571d9dfd57d6109f57ae28899a0583467a94b2 100644 (file)
@@ -787,24 +787,28 @@ TEST_F(ListTest, masterFiles) {
 }
 
 TEST_F(ListTest, BadMasterFile) {
-    // Configure one zone correctly, and one with the wrong origin
-    // (resulting in out-of-zone data)
-    // Configuration should succeed, and the correct zone should
-    // be loaded.
+    // Configure two zone correctly, and one with the wrong origin
+    // (resulting in an out-of-zone data error)
+    // Configuration should succeed, and the correct zones should
+    // be loaded. Neither the 'bad' origin or the zone it used
+    // should be loaded
     const ConstElementPtr elem(Element::fromJSON("["
         "{"
         "   \"type\": \"MasterFiles\","
         "   \"cache-enable\": true,"
         "   \"params\": {"
-        "       \"foo.bar.\": \"" TEST_DATA_DIR "/example.org\","
+        "       \"example.com.\": \"" TEST_DATA_DIR "/example.com.flattened\","
+        "       \"foo.bar.\": \"" TEST_DATA_DIR "/example.org.nsec3-signed\","
         "       \".\": \"" TEST_DATA_DIR "/root.zone\""
         "   }"
         "}]"));
     list_->configure(elem, true);
 
-    EXPECT_TRUE(negativeResult_ == list_->find(Name("example.org."), true));
-    EXPECT_TRUE(negativeResult_ == list_->find(Name("foo.bar"), true));
-    positiveResult(list_->find(Name(".")), ds_[0], Name("."), true, "com",
+    positiveResult(list_->find(Name("example.com."), true), ds_[0],
+                   Name("example.com."), true, "example.com", true);
+    EXPECT_EQ(negativeResult_, list_->find(Name("example.org."), true));
+    EXPECT_EQ(negativeResult_, list_->find(Name("foo.bar"), true));
+    positiveResult(list_->find(Name(".")), ds_[0], Name("."), true, "root",
                    true);
 }
 
diff --git a/src/lib/datasrc/tests/testdata/example.com.flattened b/src/lib/datasrc/tests/testdata/example.com.flattened
new file mode 100644 (file)
index 0000000..92d1f45
--- /dev/null
@@ -0,0 +1,3 @@
+example.com.    3600    IN  SOA ns.example.com. admin.example.com. 1234 3600 1800 2419200 7200
+example.com.    3600    IN  NS ns.example.com.
+ns.example.com.        3600    IN  A 192.0.2.1