Commit ced15db4 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2947] Add testcase to check that library errors don't cause rest of data sources to be skipped

parent db2f7c54
......@@ -16,6 +16,7 @@
#include <datasrc/client_list.h>
#include <datasrc/client.h>
#include <datasrc/factory.h>
#include <datasrc/cache_config.h>
#include <datasrc/zone_iterator.h>
#include <datasrc/exceptions.h>
......@@ -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("["
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment