mirror of
https://gitlab.isc.org/isc-projects/kea.git
synced 2025-12-20 00:53:34 +08:00
[#4176] Add mysql and pgsql tests
modified: src/hooks/dhcp/mysql/tests/mysql_lease_mgr_unittest.cc modified: src/hooks/dhcp/pgsql/tests/pgsql_lease_mgr_unittest.cc modified: src/lib/dhcpsrv/lease_mgr.cc
This commit is contained in:
@@ -1434,6 +1434,30 @@ TEST_F(MySqlLeaseMgrTest, bigStats) {
|
||||
testBigStats();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn4SameSubnet) {
|
||||
testUpdateStatsOn4SameSubnet();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn4DifferentSubnet) {
|
||||
testUpdateStatsOn4DifferentSubnet();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn6SameSubnet) {
|
||||
testUpdateStatsOn6SameSubnet();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn6SameSubnetPD) {
|
||||
testUpdateStatsOn6SameSubnetPD();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn6DifferentSubnet) {
|
||||
testUpdateStatsOn6DifferentSubnet();
|
||||
}
|
||||
|
||||
TEST_F(MySqlLeaseMgrTest, updateStatsOn6DifferentSubnetPD) {
|
||||
testUpdateStatsOn6DifferentSubnetPD();
|
||||
}
|
||||
|
||||
/// @brief Test fixture class for testing @ref CfgDbAccessTest using MySQL
|
||||
/// backend.
|
||||
class CfgMySqlLbDbAccessTest : public ::testing::Test {
|
||||
|
||||
@@ -1423,6 +1423,30 @@ TEST_F(PgSqlLeaseMgrTest, bigStats) {
|
||||
testBigStats();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn4SameSubnet) {
|
||||
testUpdateStatsOn4SameSubnet();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn4DifferentSubnet) {
|
||||
testUpdateStatsOn4DifferentSubnet();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn6SameSubnet) {
|
||||
testUpdateStatsOn6SameSubnet();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn6SameSubnetPD) {
|
||||
testUpdateStatsOn6SameSubnetPD();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn6DifferentSubnet) {
|
||||
testUpdateStatsOn6DifferentSubnet();
|
||||
}
|
||||
|
||||
TEST_F(PgSqlLeaseMgrTest, updateStatsOn6DifferentSubnetPD) {
|
||||
testUpdateStatsOn6DifferentSubnetPD();
|
||||
}
|
||||
|
||||
/// @brief Test fixture class for testing @ref CfgDbAccessTest using PostgreSQL
|
||||
/// backend.
|
||||
class CfgPgSqlLbDbAccessTest : public ::testing::Test {
|
||||
|
||||
@@ -1526,6 +1526,7 @@ LeaseMgr::updateStatsOnUpdate(const Lease4Ptr& existing,
|
||||
pool = subnet->getPool(Lease::TYPE_V4, existing->addr_, false);
|
||||
}
|
||||
|
||||
// Switch on new-state:old-state mask.
|
||||
switch (STATE_MASK(lease->state_ , existing->state_)) {
|
||||
case ASSIGNED_DECLINED:
|
||||
bumpStat("declined-addresses", existing->subnet_id_, pool, -1);
|
||||
@@ -1581,7 +1582,7 @@ LeaseMgr::updateStatsOnUpdate(const Lease4Ptr& existing,
|
||||
existing_pool = existing_subnet->getPool(Lease::TYPE_V4, existing->addr_, false);
|
||||
}
|
||||
|
||||
// Make the new state-old state mask.
|
||||
// Switch on new-state:old-state mask.
|
||||
switch (STATE_MASK(lease->state_ , existing->state_)) {
|
||||
case ASSIGNED_ASSIGNED:
|
||||
bumpStat("assigned-addresses", existing->subnet_id_, existing_pool, -1);
|
||||
@@ -1670,7 +1671,7 @@ LeaseMgr::updateStatsOnUpdate(const Lease6Ptr& existing,
|
||||
pool = subnet->getPool(existing->type_, existing->addr_, false);
|
||||
}
|
||||
|
||||
// Make the new state-old state mask.
|
||||
// Switch on new-state:old-state mask.
|
||||
switch (STATE_MASK(lease->state_, existing->state_)) {
|
||||
case ASSIGNED_DECLINED:
|
||||
bumpStat("declined-addresses", existing->subnet_id_, pool, -1);
|
||||
@@ -1766,7 +1767,7 @@ LeaseMgr::updateStatsOnUpdate(const Lease6Ptr& existing,
|
||||
existing_pool = existing_subnet->getPool(existing->type_, existing->addr_, false);
|
||||
}
|
||||
|
||||
// Make the new state-old state mask.
|
||||
// Switch on new-state:old-state mask.
|
||||
switch (STATE_MASK(lease->state_, existing->state_)) {
|
||||
case ASSIGNED_ASSIGNED:
|
||||
if (lease->type_ == Lease::TYPE_NA) {
|
||||
|
||||
Reference in New Issue
Block a user