Parcourir la source

[2342] More changes as a result of review

a) Corrected some method headers
b) Added additional diagnostic output should the test fail to
   open the database.
Stephen Morris il y a 12 ans
Parent
commit
b0ad16d99e

+ 5 - 5
src/lib/dhcp/mysql_lease_mgr.h

@@ -213,9 +213,9 @@ public:
     /// If no such lease is present, an exception will be thrown.
     virtual void updateLease4(const Lease4Ptr& lease4);
 
-    /// @brief Updates IPv4 lease.
+    /// @brief Updates IPv6 lease.
     ///
-    /// @param lease4 The lease to be updated.
+    /// @param lease6 The lease to be updated.
     ///
     /// @throw isc::dhcp::NoSuchLease Attempt to update a lease that did not
     ///        exist.
@@ -223,16 +223,16 @@ public:
     ///        failed.
     virtual void updateLease6(const Lease6Ptr& lease6);
 
-    /// @brief Deletes a lease.
+    /// @brief Deletes an IPv4 lease.
     ///
     /// @param addr IPv4 address of the lease to be deleted.
     ///
     /// @return true if deletion was successful, false if no such lease exists
     virtual bool deleteLease4(const isc::asiolink::IOAddress& addr);
 
-    /// @brief Deletes a lease.
+    /// @brief Deletes an IPv6 lease.
     ///
-    /// @param addr IPv4 address of the lease to be deleted.
+    /// @param addr IPv6 address of the lease to be deleted.
     ///
     /// @return true if deletion was successful, false if no such lease exists
     ///

+ 13 - 4
src/lib/dhcp/tests/mysql_lease_mgr_unittest.cc

@@ -174,11 +174,20 @@ public:
         L4_ADDRESS(ADDRESS_4), L4_IOADDRESS(L4_ADDRESS), 
         L5_ADDRESS(ADDRESS_5), L5_IOADDRESS(L5_ADDRESS), 
         L6_ADDRESS(ADDRESS_6), L6_IOADDRESS(L6_ADDRESS), 
-        L7_ADDRESS(ADDRESS_7), L7_IOADDRESS(L7_ADDRESS)
-        {
+        L7_ADDRESS(ADDRESS_7), L7_IOADDRESS(L7_ADDRESS) {
+
         destroySchema();
         createSchema();
-        LeaseMgrFactory::create(validConnectionString());
+        try {
+            LeaseMgrFactory::create(validConnectionString());
+        } catch (...) {
+            std::cerr << "*** ERROR: unable to open database. The test\n"
+                         "*** environment is broken and must be fixed before\n"
+                         "*** the MySQL tests will run correctly.\n"
+                         "*** The reason for the problem is described in the\n"
+                         "*** accompanying exception output.\n";
+            throw;
+        }
         lmptr_ = &(LeaseMgrFactory::instance());
     }
 
@@ -419,7 +428,7 @@ TEST(MySqlOpenTest, OpenDatabase) {
         LeaseMgrFactory::destroy();
     } catch (const isc::Exception& ex) {
         FAIL() << "*** ERROR: unable to open database, reason:\n"
-               << "    " << ex.what()
+               << "    " << ex.what() << "\n"
                << "*** The test environment is broken and must be fixed\n"
                << "*** before the MySQL tests will run correctly.\n";
     }