BIND 10 trac1332, updated. 9f89f07adcc9ccdde454016f037076e04eb791c1 [1332] added more checks in the journalReader test.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Nov 17 00:06:03 UTC 2011


The branch, trac1332 has been updated
       via  9f89f07adcc9ccdde454016f037076e04eb791c1 (commit)
       via  fdefb47da0a5d7203496738ba03d4e1737e8149e (commit)
       via  93a5d45d9c1aa90249494608b8c2829059cc3b28 (commit)
       via  c1f5fb059e9c272dedc27a3f14fa8ed2fec71b95 (commit)
       via  fd1ae8e05771b151877ae3c082a7b3e3b32a20c7 (commit)
      from  48ee64bfbde99ce88eb305d2a751283b42c826ad (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 9f89f07adcc9ccdde454016f037076e04eb791c1
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 16 15:50:15 2011 -0800

    [1332] added more checks in the journalReader test.

commit fdefb47da0a5d7203496738ba03d4e1737e8149e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 16 15:48:56 2011 -0800

    [1332] fixed a bug in the previous update to the test: termination condtion
    was wrong.

commit 93a5d45d9c1aa90249494608b8c2829059cc3b28
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 16 15:37:28 2011 -0800

    [1332] changed a type test back to mock specific test when it doesn't have
    database specific checks.  also add more detailed tests in checkJournal()
    to support generic databases.

commit c1f5fb059e9c272dedc27a3f14fa8ed2fec71b95
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 16 15:02:15 2011 -0800

    [1332] wording fix in an exception message; remove a unused commented-out line.

commit fd1ae8e05771b151877ae3c082a7b3e3b32a20c7
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Nov 16 15:00:13 2011 -0800

    [1332] typo in doxygen doc

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

Summary of changes:
 ChangeLog                                  |    2 +-
 src/lib/datasrc/client.h                   |    2 +-
 src/lib/datasrc/tests/client_unittest.cc   |    3 +-
 src/lib/datasrc/tests/database_unittest.cc |   46 +++++++++++++++++++++++++--
 4 files changed, 45 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 45671b7..58ee946 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
- 315.	[func]		tomek
+315.	[func]		tomek
 	libdhcp: Support for DHCPv4 packet manipulation is now implemented.
 	All fixed fields are now supported. Generic support for DHCPv4
 	options is available (both parsing and assembly). There is no code
diff --git a/src/lib/datasrc/client.h b/src/lib/datasrc/client.h
index 1c728e9..0cdc3ee 100644
--- a/src/lib/datasrc/client.h
+++ b/src/lib/datasrc/client.h
@@ -325,7 +325,7 @@ public:
     /// Note that the SOA serials are compared by the semantics of the serial
     /// number arithmetic.  So, for example, \c begin_serial can be larger than
     /// \c end_serial as bare unsigned integers.  The underlying data source
-    /// implementation is assumed to keep truck of sufficient history to
+    /// implementation is assumed to keep track of sufficient history to
     /// identify (if exist) the corresponding difference between the specified
     /// versions.
     ///
diff --git a/src/lib/datasrc/tests/client_unittest.cc b/src/lib/datasrc/tests/client_unittest.cc
index b39b19d..64ad25f 100644
--- a/src/lib/datasrc/tests/client_unittest.cc
+++ b/src/lib/datasrc/tests/client_unittest.cc
@@ -41,9 +41,8 @@ public:
     }
     virtual std::pair<ZoneJournalReader::Result, ZoneJournalReaderPtr>
     getJournalReader(const isc::dns::Name&, uint32_t, uint32_t) const {
-        isc_throw(isc::NotImplemented, "Journaling isn't supported for "
+        isc_throw(isc::NotImplemented, "Journaling isn't supported "
                   "in Nop data source");
-        //return (ZoneJournalReaderPtr());
     }
 };
 
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 5e453af..1b2ecb7 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -1057,6 +1057,40 @@ public:
             const MockAccessor* mock_accessor =
                 dynamic_cast<const MockAccessor*>(current_accessor_);
             mock_accessor->checkJournal(expected);
+        } else {
+            // For other generic databases, retrieve the diff using the
+            // reader class and compare the resulting sequence of RRset.
+            // For simplicity we only consider the case where the expected
+            // sequence is not empty.
+            ASSERT_FALSE(expected.empty());
+            const Name zone_name(expected.front().
+                                 data_[DatabaseAccessor::DIFF_NAME]);
+            ZoneJournalReaderPtr jnl_reader =
+                client_->getJournalReader(zone_name,
+                                          expected.front().serial_,
+                                          expected.back().serial_).second;
+            ASSERT_TRUE(jnl_reader);
+            ConstRRsetPtr rrset;
+            vector<JournalEntry>::const_iterator it = expected.begin();
+            for (rrset = jnl_reader->getNextDiff();
+                 rrset && it != expected.end();
+                 rrset = jnl_reader->getNextDiff(), ++it) {
+                typedef DatabaseAccessor Accessor;
+                RRsetPtr expected_rrset(
+                    new RRset(Name((*it).data_[Accessor::DIFF_NAME]),
+                              qclass_,
+                              RRType((*it).data_[Accessor::DIFF_TYPE]),
+                              RRTTL((*it).data_[Accessor::DIFF_TTL])));
+                expected_rrset->addRdata(
+                    rdata::createRdata(expected_rrset->getType(),
+                                       expected_rrset->getClass(),
+                                       (*it).data_[Accessor::DIFF_RDATA]));
+                isc::testutils::rrsetCheck(expected_rrset, rrset);
+            }
+            // We should have examined all entries of both expected and
+            // actual data.
+            EXPECT_TRUE(it == expected.end());
+            ASSERT_FALSE(rrset);
         }
     }
 
@@ -2970,9 +3004,10 @@ TYPED_TEST(DatabaseClientTest, journalMultiple) {
  * Note that we implicitly test in different testcases (these for add and
  * delete) that if the journaling is false, it doesn't expect the order.
  *
- * In this test we don't check with the real databases.
+ * In this test we don't check with the real databases as this case shouldn't
+ * contain backend specific behavior.
  */
-TYPED_TEST(DatabaseClientTest, journalBadSequence) {
+TEST_F(MockDatabaseClientTest, journalBadSequence) {
     std::vector<JournalEntry> expected;
     {
         SCOPED_TRACE("Delete A before SOA");
@@ -3101,8 +3136,11 @@ TYPED_TEST(DatabaseClientTest, journalReader) {
     // Check the simple case made by makeSimpleDiff.
     ConstRRsetPtr soa_end = makeSimpleDiff(*this->client_, this->zname_,
                                            this->qclass_, this->soa_);
-    ZoneJournalReaderPtr jnl_reader(this->client_->getJournalReader(
-                                        this->zname_, 1234, 1235).second);
+    pair<ZoneJournalReader::Result, ZoneJournalReaderPtr> result =
+        this->client_->getJournalReader(this->zname_, 1234, 1235);
+    EXPECT_EQ(ZoneJournalReader::SUCCESS, result.first);
+    ZoneJournalReaderPtr jnl_reader = result.second;
+    ASSERT_TRUE(jnl_reader);
     ConstRRsetPtr rrset = jnl_reader->getNextDiff();
     ASSERT_TRUE(rrset);
     isc::testutils::rrsetCheck(this->soa_, rrset);




More information about the bind10-changes mailing list