Skip to content

dbConnection.t: do not use $dbh->ping() to check if disconnected from DB [master]

Created by: mkszuba

Description

Make dbConnection.t compatible with newly released DBD::mysql-4.050 by using $dbh->{Active} rather than $dbh->ping() to confirm disconnect_when_inactive() works.

Use case

DBD::mysql::ping() cannot be relied to return false if the client has been disconnected from the database server because it actively attempts to reconnect to the database and only failed to do so in the past because of a bug. With the first version with that bug fixed, 4.050, having been released a couple of days ago, everyone always using the latest release of DBD::mysql (e.g. our Travis builds) now see the three dbConnection.t tests aiming at confirming correct operation of disconnect-when-inactive mode fail.

Benefits

DBD::mysql-4.050 can be used without test failures, which among other things means Travis becoming happy again.

Possible Drawbacks

None I can think of, DBI documentation says that while the exact meaning of the "Active" attribute is hazy it is to be set to false on the database by disconnect() and all drivers I have seen so far do observe this requirement.

Testing

Have you added/modified unit tests to test the changes?

The change is in unit tests.

If so, do the tests pass/fail?

Pass.

Have you run the entire test suite and no regression was detected?

Yes, no regression detected.

Merge request reports