44 'servers' => $servers,
49 $this->assertTrue( $dbw->getLBInfo(
'master' ),
'master shows as master' );
50 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX set on master" );
53 $this->assertTrue(
$dbr->getLBInfo(
'master' ),
'DB_REPLICA also gets the master' );
54 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX set on replica" );
56 $dbwAuto = $lb->getConnection(
DB_MASTER, [],
false, $lb::CONN_TRX_AUTO );
57 $this->assertFalse( $dbwAuto->getFlag(
$dbw::DBO_TRX ),
"No DBO_TRX with CONN_TRX_AUTO" );
58 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX still set on master" );
59 $this->assertNotEquals( $dbw, $dbwAuto,
"CONN_TRX_AUTO uses separate connection" );
61 $dbrAuto = $lb->getConnection(
DB_REPLICA, [],
false, $lb::CONN_TRX_AUTO );
62 $this->assertFalse( $dbrAuto->getFlag(
$dbw::DBO_TRX ),
"No DBO_TRX with CONN_TRX_AUTO" );
63 $this->assertTrue(
$dbr->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX still set on replica" );
64 $this->assertNotEquals(
$dbr, $dbrAuto,
"CONN_TRX_AUTO uses separate connection" );
66 $dbwAuto2 = $lb->getConnection(
DB_MASTER, [],
false, $lb::CONN_TRX_AUTO );
67 $this->assertEquals( $dbwAuto2, $dbwAuto,
"CONN_TRX_AUTO reuses connections" );
99 'servers' => $servers,
101 'loadMonitorClass' =>
'LoadMonitorNull'
105 $this->assertTrue( $dbw->getLBInfo(
'master' ),
'master shows as master' );
108 $dbw->getLBInfo(
'clusterMasterHost' ),
109 'cluster master set' );
110 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX set on master" );
113 $this->assertTrue(
$dbr->getLBInfo(
'replica' ),
'slave shows as slave' );
116 $dbr->getLBInfo(
'clusterMasterHost' ),
117 'cluster master set' );
118 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX set on replica" );
120 $dbwAuto = $lb->getConnection(
DB_MASTER, [],
false, $lb::CONN_TRX_AUTO );
121 $this->assertFalse( $dbwAuto->getFlag(
$dbw::DBO_TRX ),
"No DBO_TRX with CONN_TRX_AUTO" );
122 $this->assertTrue( $dbw->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX still set on master" );
123 $this->assertNotEquals( $dbw, $dbwAuto,
"CONN_TRX_AUTO uses separate connection" );
125 $dbrAuto = $lb->getConnection(
DB_REPLICA, [],
false, $lb::CONN_TRX_AUTO );
126 $this->assertFalse( $dbrAuto->getFlag(
$dbw::DBO_TRX ),
"No DBO_TRX with CONN_TRX_AUTO" );
127 $this->assertTrue(
$dbr->getFlag(
$dbw::DBO_TRX ),
"DBO_TRX still set on replica" );
128 $this->assertNotEquals(
$dbr, $dbrAuto,
"CONN_TRX_AUTO uses separate connection" );
130 $dbwAuto2 = $lb->getConnection(
DB_MASTER, [],
false, $lb::CONN_TRX_AUTO );
131 $this->assertEquals( $dbwAuto2, $dbwAuto,
"CONN_TRX_AUTO reuses connections" );