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