From 3cd2f11f10f0e6087c69fa54bf6032997a7e8de5 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Fri, 17 Jan 2020 15:37:27 +0200 Subject: [PATCH] [#1040] updated unittests --- .../dhcpsrv/tests/cql_lease_mgr_unittest.cc | 1 + .../dhcpsrv/tests/mysql_lease_mgr_unittest.cc | 28 ++++++++++++++---- .../dhcpsrv/tests/pgsql_lease_mgr_unittest.cc | 29 +++++++++++++++---- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc index 742b36dc79..618febbe0c 100644 --- a/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc @@ -443,6 +443,7 @@ TEST(CqlOpenTest, OpenDatabase) { // Tidy up after the test destroyCqlSchema(); + LeaseMgrFactory::destroy(); } /// @brief Check the getType() method diff --git a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc index 61e2cdbe6a..37511bcf62 100644 --- a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc @@ -335,6 +335,12 @@ TEST_F(MySqlLeaseMgrTest, updateLease4) { testUpdateLease4(); } +/// @brief Lease4 update tests +TEST_F(MySqlLeaseMgrTest, updateLease4MultiThreading) { + MultiThreadingMgr::instance().setMode(true); + testUpdateLease4(); +} + /// @brief Lease4 concurrent update tests /// /// Checks that we are not able to concurrently update a lease in the database. @@ -342,10 +348,12 @@ TEST_F(MySqlLeaseMgrTest, concurrentUpdateLease4) { testConcurrentUpdateLease4(); } -/// @brief Lease4 update tests -TEST_F(MySqlLeaseMgrTest, updateLease4MultiThreading) { +/// @brief Lease4 concurrent update tests +/// +/// Checks that we are not able to concurrently update a lease in the database. +TEST_F(MySqlLeaseMgrTest, concurrentUpdateLease4MultiThreading) { MultiThreadingMgr::instance().setMode(true); - testUpdateLease4(); + testConcurrentUpdateLease4(); } /// @brief Check GetLease4 methods - access by Hardware Address @@ -777,6 +785,12 @@ TEST_F(MySqlLeaseMgrTest, updateLease6) { testUpdateLease6(); } +/// @brief Lease6 update tests +TEST_F(MySqlLeaseMgrTest, updateLease6MultiThreading) { + MultiThreadingMgr::instance().setMode(true); + testUpdateLease6(); +} + /// @brief Lease6 concurrent update tests /// /// Checks that we are not able to concurrently update a lease in the database. @@ -784,10 +798,12 @@ TEST_F(MySqlLeaseMgrTest, concurrentUpdateLease6) { testConcurrentUpdateLease6(); } -/// @brief Lease6 update tests -TEST_F(MySqlLeaseMgrTest, updateLease6MultiThreading) { +/// @brief Lease6 concurrent update tests +/// +/// Checks that we are not able to concurrently update a lease in the database. +TEST_F(MySqlLeaseMgrTest, concurrentUpdateLease6MultiThreading) { MultiThreadingMgr::instance().setMode(true); - testUpdateLease6(); + testConcurrentUpdateLease6(); } /// @brief DHCPv4 Lease recreation tests diff --git a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc index cf93a4a5ed..ab14d6c58e 100644 --- a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc @@ -196,6 +196,7 @@ TEST(PgSqlOpenTest, OpenDatabase) { // Tidy up after the test destroyPgSQLSchema(); + LeaseMgrFactory::destroy(); } /// @brief Check that database can be opened with Multi-Threading @@ -290,6 +291,12 @@ TEST_F(PgSqlLeaseMgrTest, updateLease4) { testUpdateLease4(); } +/// @brief Lease4 update tests +TEST_F(PgSqlLeaseMgrTest, updateLease4MultiThreading) { + MultiThreadingMgr::instance().setMode(true); + testUpdateLease4(); +} + /// @brief Lease4 concurrent update tests /// /// Checks that we are not able to concurrently update a lease in the database. @@ -297,10 +304,12 @@ TEST_F(PgSqlLeaseMgrTest, concurrentUpdateLease4) { testConcurrentUpdateLease4(); } -/// @brief Lease4 update tests -TEST_F(PgSqlLeaseMgrTest, updateLease4MultiThreading) { +/// @brief Lease4 concurrent update tests +/// +/// Checks that we are not able to concurrently update a lease in the database. +TEST_F(PgSqlLeaseMgrTest, concurrentUpdateLease4MultiThreading) { MultiThreadingMgr::instance().setMode(true); - testUpdateLease4(); + testConcurrentUpdateLease4(); } /// @brief Check GetLease4 methods - access by Hardware Address @@ -732,6 +741,12 @@ TEST_F(PgSqlLeaseMgrTest, updateLease6) { testUpdateLease6(); } +/// @brief Lease6 update tests +TEST_F(PgSqlLeaseMgrTest, updateLease6MultiThreading) { + MultiThreadingMgr::instance().setMode(true); + testUpdateLease6(); +} + /// @brief Lease6 concurrent update tests /// /// Checks that we are not able to concurrently update a lease in the database. @@ -739,10 +754,12 @@ TEST_F(PgSqlLeaseMgrTest, concurrentUpdateLease6) { testConcurrentUpdateLease6(); } -/// @brief Lease6 update tests -TEST_F(PgSqlLeaseMgrTest, updateLease6MultiThreading) { +/// @brief Lease6 concurrent update tests +/// +/// Checks that we are not able to concurrently update a lease in the database. +TEST_F(PgSqlLeaseMgrTest, concurrentUpdateLease6MultiThreading) { MultiThreadingMgr::instance().setMode(true); - testUpdateLease6(); + testConcurrentUpdateLease6(); } /// @brief DHCPv4 Lease recreation tests