+ /**
+ * @covers \Wikimedia\Rdbms\LoadBalancer::getConnection()
+ */
+ public function testGetConnectionRefDefaultGroup() {
+ $lb = $this->newMultiServerLocalLoadBalancer( [ 'defaultGroup' => 'vslow' ] );
+ $lbWrapper = TestingAccessWrapper::newFromObject( $lb );
+
+ $rVslow = $lb->getConnectionRef( DB_REPLICA );
+ $vslowIndexPicked = $rVslow->getLBInfo( 'serverIndex' );
+
+ $this->assertSame( $vslowIndexPicked, $lbWrapper->getExistingReaderIndex( 'vslow' ) );
+ }
+
+ /**
+ * @covers \Wikimedia\Rdbms\LoadBalancer::getConnection()
+ */
+ public function testGetConnectionRefUnknownDefaultGroup() {
+ $lb = $this->newMultiServerLocalLoadBalancer( [ 'defaultGroup' => 'invalid' ] );
+
+ $this->assertInstanceOf(
+ IDatabase::class,
+ $lb->getConnectionRef( DB_REPLICA )
+ );
+ }
+