From: Tomek Mrugalski Date: Wed, 11 Sep 2013 15:14:19 +0000 (+0200) Subject: [3146] Minor changes after review: X-Git-Tag: bind10-1.2.0beta1-release~222^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=05a05d810be754e7a4d8ca181550867febf6dcc6;p=thirdparty%2Fkea.git [3146] Minor changes after review: - LeaseType is now initalized from static array - @todos added in 2 MySQL tests - Added a comment about lease type values to MySQL schema --- diff --git a/src/lib/dhcpsrv/dhcpdb_create.mysql b/src/lib/dhcpsrv/dhcpdb_create.mysql index a819061d83..10531e3f1e 100644 --- a/src/lib/dhcpsrv/dhcpdb_create.mysql +++ b/src/lib/dhcpsrv/dhcpdb_create.mysql @@ -76,7 +76,9 @@ CREATE INDEX lease6_by_iaid_subnet_id_duid ON lease6 (iaid, subnet_id, duid); # ... and a definition of lease6 types. This table is a convenience for # users of the database - if they want to view the lease table and use the -# type names, they can join this table with the lease6 table +# type names, they can join this table with the lease6 table. +# Make sure those values match Lease6::LeaseType enum (see src/bin/dhcpsrv/ +# lease_mgr.h) CREATE TABLE lease6_types ( lease_type TINYINT PRIMARY KEY NOT NULL, # Lease type code. name VARCHAR(5) # Name of the lease type diff --git a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc index 25bf1c8950..52a39e9a7a 100644 --- a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc @@ -824,6 +824,7 @@ TEST_F(MySqlLeaseMgrTest, getLease4ClientIdSubnetId) { /// /// Adds leases to the database and checks that they can be accessed via /// a combination of DIUID and IAID. +/// @todo: update this test once type checking/filtering is implemented TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) { // Get the leases to be used for the test. vector leases = createLeases6(); @@ -870,6 +871,7 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) { // @brief Get Lease4 by DUID and IAID (2) // // Check that the system can cope with a DUID of any size. +/// @todo: update this test once type checking/filtering is implemented TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSize) { // Create leases, although we need only one. diff --git a/src/lib/dhcpsrv/tests/test_utils.cc b/src/lib/dhcpsrv/tests/test_utils.cc index 01f2bb8aff..85b242323a 100644 --- a/src/lib/dhcpsrv/tests/test_utils.cc +++ b/src/lib/dhcpsrv/tests/test_utils.cc @@ -36,6 +36,13 @@ const char* ADDRESS6[] = { NULL }; +// Lease types that correspond to ADDRESS6 leases +static const Lease6::LeaseType LEASETYPE6[] = { + Lease6::LEASE_IA_NA, Lease6::LEASE_IA_TA, Lease6::LEASE_IA_PD, + Lease6::LEASE_IA_NA, Lease6::LEASE_IA_TA, Lease6::LEASE_IA_PD, + Lease6::LEASE_IA_NA, Lease6::LEASE_IA_TA +}; + void detailCompareLease(const Lease4Ptr& first, const Lease4Ptr& second) { // Compare address strings. Comparison of address objects is not used, as @@ -109,8 +116,9 @@ GenericLeaseMgrTest::GenericLeaseMgrTest() IOAddress ioaddr(addr); ioaddress6_.push_back(ioaddr); - /// Let's create different lease types - leasetype6_.push_back(static_cast(i%3)); + /// Let's create different lease types. We use LEASETYPE6 values as + /// a template + leasetype6_.push_back(LEASETYPE6[i]); } }