From 0c98c5d4a2e40e4a1e9511439fdcf3d87b609be7 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 5 Apr 2019 12:36:34 -0700 Subject: [PATCH] Make teardownTestDB() close any dangling connections before changing the prefix Bug: T219673 Change-Id: I028fc16b874cac744f7215601eec754a76f31a3f --- tests/phpunit/MediaWikiTestCase.php | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.20.1