BIND 10 trac2993, updated. b4f1cd645efbda886e123943b5e14222b40e7a9c [2993] Add unittest for the case where ZoneWriter encounters a bad zone and must throw

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jun 27 03:33:50 UTC 2013


The branch, trac2993 has been updated
       via  b4f1cd645efbda886e123943b5e14222b40e7a9c (commit)
      from  204733844d2984ed49eb8e2da89666f6a1729732 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b4f1cd645efbda886e123943b5e14222b40e7a9c
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Jun 27 09:03:40 2013 +0530

    [2993] Add unittest for the case where ZoneWriter encounters a bad zone and must throw

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/tests/client_list_unittest.cc |   27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 602fa73..eb69556 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -1067,6 +1067,33 @@ TEST_P(ListTest, checkZoneWriterCatchesExceptions) {
     result.second->cleanup();
 }
 
+// Check that ZoneWriter throws when asked to
+TEST_P(ListTest, checkZoneWriterThrows) {
+    const ConstElementPtr config_elem_zones_(Element::fromJSON("["
+        "{"
+        "   \"type\": \"MasterFiles\","
+        "   \"params\": {"
+        "       \"example.edu\": \"" TEST_DATA_DIR "example.edu-broken\""
+        "    },"
+        "   \"cache-enable\": true"
+        "}]"));
+
+    list_->configure(config_elem_zones_, true);
+    ConfigurableClientList::ZoneWriterPair
+        result(list_->getCachedZoneWriter(Name("example.edu"), false));
+    ASSERT_EQ(ConfigurableClientList::ZONE_SUCCESS, result.first);
+    ASSERT_TRUE(result.second);
+
+    std::string error_msg;
+    // Because of the way we called getCachedZoneWriter() with
+    // catch_load_error=false, the following should throw and must not
+    // modify error_msg.
+    EXPECT_THROW(result.second->load(&error_msg),
+                 isc::datasrc::ZoneLoaderException);
+    EXPECT_TRUE(error_msg.empty());
+    result.second->cleanup();
+}
+
 // Test we can reload a zone
 TEST_P(ListTest, reloadSuccess) {
     list_->configure(config_elem_zones_, true);



More information about the bind10-changes mailing list