From: Mukund Sivaraman Date: Tue, 18 Jun 2013 10:52:04 +0000 (+0530) Subject: [2947] Add testcase to check that library errors don't cause rest of data sources... X-Git-Tag: bind10-1.2.0beta1-release~389^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ced15db4ec415ce080457136acebf66bebd7bf7d;p=thirdparty%2Fkea.git [2947] Add testcase to check that library errors don't cause rest of data sources to be skipped --- diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc index 5b173a90df..36c50056f6 100644 --- a/src/lib/datasrc/tests/client_list_unittest.cc +++ b/src/lib/datasrc/tests/client_list_unittest.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -71,6 +72,10 @@ public: if (type == "error") { isc_throw(DataSourceError, "The error data source type"); } + if (type == "library_error") { + isc_throw(DataSourceLibraryError, + "The library error data source type"); + } if (type == "MasterFiles") { return (DataSourcePair(0, DataSourceClientContainerPtr())); } @@ -705,6 +710,35 @@ TEST_P(ListTest, dataSrcError) { checkDS(0, "test_type", "{}", false); } +// In case of library errors, the rest of the data sources should be +// unaffected. +TEST_P(ListTest, dataSrcLibraryError) { + EXPECT_EQ(0, list_->getDataSources().size()); + const ConstElementPtr elem(Element::fromJSON("[" + "{" + " \"type\": \"type1\"," + " \"cache-enable\": false," + " \"params\": {}" + "}," + "{" + " \"type\": \"library_error\"," + " \"cache-enable\": false," + " \"params\": {}" + "}," + "{" + " \"type\": \"type2\"," + " \"cache-enable\": false," + " \"params\": {}" + "}]" + )); + list_->configure(elem, true); + EXPECT_EQ(2, list_->getDataSources().size()); + checkDS(0, "type1", "{}", false); + checkDS(1, "type2", "{}", false); + // Check the exact configuration is preserved + EXPECT_EQ(elem, list_->getConfiguration()); +} + // Check we can get the cache TEST_P(ListTest, configureCacheEmpty) { const ConstElementPtr elem(Element::fromJSON("["