Commit 9cccfbbc authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2862] Signal if segment was reset by result

parent f1c0d707
......@@ -330,7 +330,7 @@ ConfigurableClientList::findInternal(MutableResult& candidate,
// and the need_updater parameter is true, get the zone there.
}
void
bool
ConfigurableClientList::resetMemorySegment
(const std::string& datasrc_name,
ZoneTableSegment::MemorySegmentOpenMode mode,
......@@ -340,9 +340,10 @@ ConfigurableClientList::resetMemorySegment
if (info.name_ == datasrc_name) {
ZoneTableSegment& segment = *info.ztable_segment_;
segment.reset(mode, config_params);
break;
return true;
}
}
return false;
}
ConfigurableClientList::ZoneWriterPair
......
......@@ -385,7 +385,8 @@ public:
/// \param datasrc_name The name of the data source whose segment to reset
/// \param mode The open mode for the new memory segment
/// \param config_params The configuration for the new memory segment.
void resetMemorySegment
/// \return If the data source was found and reset.
bool resetMemorySegment
(const std::string& datasrc_name,
memory::ZoneTableSegment::MemorySegmentOpenMode mode,
isc::data::ConstElementPtr config_params);
......
......@@ -368,7 +368,8 @@ public:
const std::string& datasrc_name,
ZoneTableSegment::MemorySegmentOpenMode mode,
ConstElementPtr config_params) {
list.resetMemorySegment(datasrc_name, mode, config_params);
EXPECT_TRUE(list.resetMemorySegment(datasrc_name, mode,
config_params));
}
virtual std::string getType() {
return ("mapped");
......@@ -383,6 +384,13 @@ INSTANTIATE_TEST_CASE_P(ListTestMapped, ListTest,
#endif
// Calling reset on empty list finds no data and returns false.
TEST_P(ListTest, emptyReset) {
EXPECT_FALSE(list_->resetMemorySegment("Something",
memory::ZoneTableSegment::CREATE,
Element::create()));
}
// Test the test itself
TEST_P(ListTest, selfTest) {
EXPECT_EQ(result::SUCCESS, ds_[0]->findZone(Name("example.org")).code);
......
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