From: Aaron Schulz Date: Fri, 5 Apr 2019 19:36:34 +0000 (-0700) Subject: Make teardownTestDB() close any dangling connections before changing the prefix X-Git-Tag: 1.34.0-rc.0~2143 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=0c98c5d4a2e40e4a1e9511439fdcf3d87b609be7;p=lhc%2Fweb%2Fwiklou.git Make teardownTestDB() close any dangling connections before changing the prefix Bug: T219673 Change-Id: I028fc16b874cac744f7215601eec754a76f31a3f --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index f43f0a9dd3..5119d737f2 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1364,6 +1364,9 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { JobQueueGroup::singleton()->get( $type )->delete(); } + // T219673: close any connections from code that failed to call reuseConnection() + // or is still holding onto a DBConnRef instance (e.g. in a singleton). + MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->closeAll(); CloneDatabase::changePrefix( self::$oldTablePrefix ); self::$oldTablePrefix = false;