BIND 10 #2837: MySQL STRICT mode causes libdhcpsrv unit tests t fail when MySQL STRICT mode is enabled
BIND 10 Development
do-not-reply at isc.org
Fri Mar 1 12:16:55 UTC 2013
#2837: MySQL STRICT mode causes libdhcpsrv unit tests t fail when MySQL STRICT
mode is enabled
-------------------------------------+-------------------------------------
Reporter: tmark | Owner:
Type: | Status: new
defect | Milestone: DHCP
Priority: | Outstanding Tasks
medium | Keywords:
Component: | Sensitive: 0
libdhcp | Sub-Project: DNS
CVSS Scoring: | Estimated Difficulty: 0
Defect Severity: N/A | Total Hours: 0
Feature Depending on Ticket: |
Add Hours to Ticket: 0 |
Internal?: 0 |
-------------------------------------+-------------------------------------
The following two unit tests in /src/lib/dhcpsrv/tests fail:
[ RUN ] MySqlLeaseMgrTest.getLease4HwaddrSize
unknown file: Failure
C++ exception with description "unable to execute for <INSERT INTO
lease4(address, hwaddr, client_id, valid_lifetime, expire, subnet_id)
VALUES (?, ?, ?, ?, ?, ?)>, reason: Data too long for column 'hwaddr' at
row 1
(error code 1406)" thrown in the test body.
[ FAILED ] MySqlLeaseMgrTest.getLease4HwaddrSize (96 ms)
:
[ RUN ] MySqlLeaseMgrTest.getLease4HwaddrSubnetIdSize
unknown file: Failure
C++ exception with description "unable to execute for <INSERT INTO
lease4(address, hwaddr, client_id, valid_lifetime, expire, subnet_id)
VALUES (?, ?, ?, ?, ?, ?)>, reason: Data too long for column 'hwaddr' at
row 1
(error code 1406)" thrown in the test body.
[ FAILED ] MySqlLeaseMgrTest.getLease4HwaddrSubnetIdSize (59 ms)
:
If MySQL STRICT mode is enabled (see STRICT_TRANSACTION_TABLES or
STRICT_ALL_TABLES).
Certain versions/installations of MySQL have STRICT mode enabled by
default. This
causes "out of range" values (i.e. too long) to generate an ERROR response
rather than
truncate. These two tests only "pass" when STRICT mode is disabled.
Actions needed:
1. Ensure that STRICT mode is always enabled. This may be done
using a call to mysql_options immediately after mysql_init:
mysql_options (&mysql_, "set SESSION sql_mode = 'STRICT_ALL_TABLES';");
(Should explore if there are any other modes we should set. Perhaps a
configurable list?)
2. Alter the tests such that they expect an exception.
Currently the tests add a value that is 1 too long and then expect NOT to
find it. In other
words they search for HwAddress-too-long, which should not match the value
actually inserted.
3. Lease4::HWADDR_MAX should be defined in "hwaddr" class, not in Lease4
class
4. An attempt to create a hwaddr object should fail - probably with an
InvalidParameter exception -
if the passed-in length of the hardware address is too large.
--
Ticket URL: <http://bind10.isc.org/ticket/2837>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list