aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2024-05-29 00:23:16 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2024-05-29 00:23:16 +0000
commit68593e5c5a6ea23e9b9a8eda5962555fa33f53e0 (patch)
tree07b0c8a05bd2c6964c5503468e7dd27ef3b65dd9 /tests/phpunit
parente478e4627ed57918b06e1a685e001cbe87c70e28 (diff)
parent091f58c44104b1d35007155d84b1fcc357cbd0d0 (diff)
downloadmediawikicore-68593e5c5a6ea23e9b9a8eda5962555fa33f53e0.tar.gz
mediawikicore-68593e5c5a6ea23e9b9a8eda5962555fa33f53e0.zip
Merge "rdbms: Drop IDatabase::getTopologyRole()"
Diffstat (limited to 'tests/phpunit')
-rw-r--r--tests/phpunit/includes/db/LBFactoryTest.php33
-rw-r--r--tests/phpunit/includes/db/LoadBalancerTest.php9
2 files changed, 9 insertions, 33 deletions
diff --git a/tests/phpunit/includes/db/LBFactoryTest.php b/tests/phpunit/includes/db/LBFactoryTest.php
index 2669639be1bb..67a5a450e715 100644
--- a/tests/phpunit/includes/db/LBFactoryTest.php
+++ b/tests/phpunit/includes/db/LBFactoryTest.php
@@ -75,12 +75,9 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
$lb = $factory->getMainLB();
$dbw = $lb->getConnection( DB_PRIMARY );
- $this->assertEquals(
- $dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'master shows as master' );
-
+ $this->assertNotFalse( $dbw );
$dbr = $lb->getConnection( DB_REPLICA );
- $this->assertEquals(
- $dbr::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'replica shows as replica' );
+ $this->assertNotFalse( $dbr );
$this->assertSame( 'DEFAULT', $lb->getClusterName() );
@@ -103,16 +100,9 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
$lb = $factory->getMainLB();
$dbw = $lb->getConnection( DB_PRIMARY );
- $dbw->ensureConnection();
-
- $this->assertEquals(
- $dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'primary shows as primary' );
-
+ $this->assertNotFalse( $dbw );
$dbr = $lb->getConnection( DB_REPLICA );
- $dbr->ensureConnection();
-
- $this->assertEquals(
- $dbr::ROLE_STREAMING_REPLICA, $dbr->getTopologyRole(), 'replica shows as replica' );
+ $this->assertNotFalse( $dbr );
$factory->shutdown();
}
@@ -122,13 +112,11 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 's3', $factory->getMainLB()->getClusterName() );
- $dbw = $factory->getMainLB()->getConnection( DB_PRIMARY );
- $this->assertEquals(
- $dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'master shows as master' );
-
- $dbr = $factory->getMainLB()->getConnection( DB_REPLICA );
- $this->assertEquals(
- $dbr::ROLE_STREAMING_REPLICA, $dbr->getTopologyRole(), 'replica shows as replica' );
+ $lb = $factory->getMainLB();
+ $dbw = $lb->getConnection( DB_PRIMARY );
+ $this->assertNotFalse( $dbw );
+ $dbr = $lb->getConnection( DB_REPLICA );
+ $this->assertNotFalse( $dbr );
// Destructor should trigger without round stage errors
unset( $factory );
@@ -783,7 +771,6 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
// Connection refs should detect the config change, close the old connection,
// and get a new connection.
$this->assertTrue( $ref->isOpen() );
- $this->assertSame( IDatabase::ROLE_STREAMING_MASTER, $ref->getTopologyRole() );
// The old connection should have been closed by DBConnRef.
$this->assertFalse( $con->isOpen() );
@@ -848,7 +835,6 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
// Connection refs should detect the config change, close the old connection,
// and get a new connection.
$this->assertTrue( $ref->isOpen() );
- $this->assertSame( IDatabase::ROLE_STREAMING_REPLICA, $ref->getTopologyRole() );
// The old connection should have been closed by DBConnRef.
$this->assertFalse( $con->isOpen() );
}
@@ -905,7 +891,6 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
// Connection refs should detect the config change, close the old connection,
// and get a new connection.
$this->assertTrue( $ref->isOpen() );
- $this->assertSame( IDatabase::ROLE_STREAMING_MASTER, $ref->getTopologyRole() );
// The old connection should have been called by DBConnRef.
$this->assertFalse( $con->isOpen() );
diff --git a/tests/phpunit/includes/db/LoadBalancerTest.php b/tests/phpunit/includes/db/LoadBalancerTest.php
index fd4b0742c97e..e9b467b022f8 100644
--- a/tests/phpunit/includes/db/LoadBalancerTest.php
+++ b/tests/phpunit/includes/db/LoadBalancerTest.php
@@ -95,15 +95,10 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase {
$dbw->ensureConnection();
$this->assertFalse( $called, "Session replication pos not used with single server" );
- $this->assertSame(
- $dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'master shows as master'
- );
$this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on master" );
$this->assertWriteAllowed( $dbw );
$dbr = $lb->getConnection( DB_REPLICA );
- $this->assertSame(
- $dbr::ROLE_STREAMING_MASTER, $dbr->getTopologyRole(), 'DB_REPLICA also gets the master' );
$this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on replica" );
if ( !$lb->getServerAttributes( $lb->getWriterIndex() )[Database::ATTR_DB_LEVEL_LOCKING] ) {
@@ -156,8 +151,6 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase {
$wConn = TestingAccessWrapper::newFromObject( $dbw )->conn;
$wConnWrap = TestingAccessWrapper::newFromObject( $wConn );
- $this->assertSame(
- $dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'primary shows as primary' );
$this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on primary" );
$this->assertWriteAllowed( $dbw );
@@ -166,8 +159,6 @@ class LoadBalancerTest extends MediaWikiIntegrationTestCase {
$rConn = TestingAccessWrapper::newFromObject( $dbr )->conn;
$rConnWrap = TestingAccessWrapper::newFromObject( $rConn );
- $this->assertSame(
- $dbr::ROLE_STREAMING_REPLICA, $dbr->getTopologyRole(), 'replica shows as replica' );
$this->assertTrue( $dbr->isReadOnly(), 'replica shows as replica' );
$this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on replica" );
$this->assertSame( $dbr->getLBInfo( 'serverIndex' ), $lb->getReaderIndex() );