BIND 10 trac1287, updated. 2104208cfcc7ab912cf2d530697c7192608f3c5d [1287] added a note that startTransaction() cannot be called more than once on a MockAccessor object. Also added check code to detect any such attempt.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 2 17:54:27 UTC 2011


The branch, trac1287 has been updated
       via  2104208cfcc7ab912cf2d530697c7192608f3c5d (commit)
       via  7e1e5f38f1d28c8e19337fb56f3dacba81341ec8 (commit)
       via  8635b169171d0d88ce19f46039ded6e1dab7b72c (commit)
      from  9aaf85731baa1ea5fe9484efc9bf48b264f60d1e (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 2104208cfcc7ab912cf2d530697c7192608f3c5d
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 2 10:53:15 2011 -0700

    [1287] added a note that startTransaction() cannot be called more than once
    on a MockAccessor object.  Also added check code to detect any such attempt.

commit 7e1e5f38f1d28c8e19337fb56f3dacba81341ec8
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 2 10:45:58 2011 -0700

    [1287] fixed a typo in a test name

commit 8635b169171d0d88ce19f46039ded6e1dab7b72c
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 2 10:45:05 2011 -0700

    [1287] cleanup: removed a now-unnecessary method.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/database.cc                |    3 ---
 src/lib/datasrc/tests/database_unittest.cc |   19 +++++++++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 446360c..3b079c6 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -783,9 +783,6 @@ public:
         return (rrset);
     }
 
-    virtual ZoneFinder& getFinder() {
-        isc_throw(NotImplemented, "Not implemented");
-    }
 private:
     // Load next row of data
     void getData() {
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 5aed804..9775321 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -279,7 +279,7 @@ class MockAccessor : public NopAccessor {
                      NameCompare > Domains;
 
 public:
-    MockAccessor() : rollbacked_(false) {
+    MockAccessor() : rollbacked_(false), did_transaction_(false) {
         readonly_records_ = &readonly_records_master_;
         update_records_ = &update_records_master_;
         empty_records_ = &empty_records_master_;
@@ -299,8 +299,18 @@ public:
         // Currently we only use this transaction for simple read-only
         // operations.  So we just make a local copy of the data (we don't
         // care about what happens after commit() or rollback()).
+        // Obviously as a consequence, if a test case tries to make multiple
+        // transactions on a single mock accessor it will fail.
+
+        // Check any attempt of multiple transactions
+        if (did_transaction_) {
+            isc_throw(isc::Unexpected, "MockAccessor::startTransaction() "
+                      "called multiple times - likely a bug in the test");
+        }
+
         readonly_records_copy_ = *readonly_records_;
         readonly_records_ = &readonly_records_copy_;
+        did_transaction_ = true;
     }
 
 private:
@@ -650,8 +660,6 @@ private:
     const Domains empty_records_master_;
     const Domains* empty_records_;
 
-    // used as temporary storage during the building of the fake data
-
     // used as temporary storage after searchForRecord() and during
     // getNextRecord() calls, as well as during the building of the
     // fake data
@@ -667,6 +675,9 @@ private:
     // Remember the mock accessor that was last cloned
     boost::shared_ptr<MockAccessor> latest_clone_;
 
+    // Internal flag for duplicate check
+    bool did_transaction_;
+
     const Domains& getMockRecords(int zone_id) const {
         if (zone_id == READONLY_ZONE_ID) {
             return (*readonly_records_);
@@ -1132,7 +1143,7 @@ TYPED_TEST(DatabaseClientTest, updateThenIterateThenUpdate) {
     this->updater_->commit();
 }
 
-TYPED_TEST(DatabaseClientTest, updateAfterDelteIterator) {
+TYPED_TEST(DatabaseClientTest, updateAfterDeleteIterator) {
     // Similar to the previous case, but we delete the iterator in the
     // middle of zone.  The transaction should be canceled (actually no
     // different from commit though) at that point.




More information about the bind10-changes mailing list