Browse Source

[2178] add another correct zone to the test

Jelte Jansen 12 years ago
parent
commit
33c57e4cef

+ 12 - 8
src/lib/datasrc/tests/client_list_unittest.cc

@@ -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);
 }
 

+ 3 - 0
src/lib/datasrc/tests/testdata/example.com.flattened

@@ -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