BIND 10 trac2850_2, updated. 03ce449ee10c5a8d8f60a68cb42839b9ae63ec00 [2850] Fix ZoneTableSegmentMappedTest.resetBadConfig test
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon May 6 07:14:40 UTC 2013
The branch, trac2850_2 has been updated
via 03ce449ee10c5a8d8f60a68cb42839b9ae63ec00 (commit)
from 9784a1841ff7a5f08c92a0c646bbc4ff9a0b4ccb (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 03ce449ee10c5a8d8f60a68cb42839b9ae63ec00
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon May 6 12:44:06 2013 +0530
[2850] Fix ZoneTableSegmentMappedTest.resetBadConfig test
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_table_segment.h | 6 +++++
.../memory/zone_table_segment_mapped_unittest.cc | 27 +++++++++++++++-----
2 files changed, 26 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_table_segment.h b/src/lib/datasrc/memory/zone_table_segment.h
index 197ac08..eef8d0b 100644
--- a/src/lib/datasrc/memory/zone_table_segment.h
+++ b/src/lib/datasrc/memory/zone_table_segment.h
@@ -208,6 +208,12 @@ public:
/// the exception documentation below. Code that uses
/// \c ZoneTableSegment would depend on such assurances.
///
+ /// First, in case an existing memory segment is in use, and an
+ /// invalid config is passed to \c reset(), the existing memory
+ /// store must still be available and the \c isc::InvalidParameter
+ /// exception must be thrown. In this case, the segment is still
+ /// usable.
+ ///
/// In case an existing memory store is in use, and an attempt to
/// open a different memory store fails, the existing memory store
/// must still be available and the \c ResetFailed exception must be
diff --git a/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc b/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
index 86718e9..a4a6565 100644
--- a/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_table_segment_mapped_unittest.cc
@@ -127,43 +127,56 @@ TEST_F(ZoneTableSegmentMappedTest, isWritableUninitialized) {
}
TEST_F(ZoneTableSegmentMappedTest, resetBadConfig) {
+ // Open a mapped file in create mode.
+ ztable_segment_->reset(ZoneTableSegment::CREATE, config_params_);
+
+ // Populate it with some data.
+ createData(ztable_segment_->getMemorySegment());
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
+
+ // All the following resets() with invalid configuration must
+ // provide a strong exception guarantee that the segment is still
+ // usable as before.
+
// NULL is passed in config params
EXPECT_THROW({
ztable_segment_->reset(ZoneTableSegment::CREATE,
ConstElementPtr());
}, isc::InvalidParameter);
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
+
// Not a map
EXPECT_THROW({
ztable_segment_->reset(ZoneTableSegment::CREATE,
Element::fromJSON("42"));
}, isc::InvalidParameter);
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
+
// Empty map
EXPECT_THROW({
ztable_segment_->reset(ZoneTableSegment::CREATE,
Element::fromJSON("{}"));
}, isc::InvalidParameter);
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
+
// No "mapped-file" key
EXPECT_THROW({
ztable_segment_->reset(ZoneTableSegment::CREATE,
Element::fromJSON("{\"foo\": \"bar\"}"));
}, isc::InvalidParameter);
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
+
// Value of "mapped-file" key is not a string
EXPECT_THROW({
ztable_segment_->reset(ZoneTableSegment::CREATE,
Element::fromJSON("{\"mapped-file\": 42}"));
}, isc::InvalidParameter);
- // The following should still throw, unaffected by the failed opens.
- EXPECT_THROW(ztable_segment_->getHeader(), isc::InvalidOperation);
- EXPECT_THROW(ztable_segment_->getMemorySegment(), isc::InvalidOperation);
-
- // isWritable() must still return false, because the segment has not
- // been successfully reset() yet.
- EXPECT_FALSE(ztable_segment_->isWritable());
+ EXPECT_TRUE(verifyData(ztable_segment_->getMemorySegment()));
}
TEST_F(ZoneTableSegmentMappedTest, reset) {
More information about the bind10-changes
mailing list