Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5954785
DatabaseLagTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DatabaseLagTest.php
View Options
<?php
namespace
MediaWiki\Tests\Maintenance
;
use
Wikimedia\Rdbms\ILoadBalancer
;
/**
* @covers \DatabaseLag
* @group Maintenance
*/
class
DatabaseLagTest
extends
MaintenanceBaseTestCase
{
public
function
getMaintenanceClass
()
{
return
\DatabaseLag
::
class
;
}
public
static
function
provideLagTimes
()
{
return
[
'No lag'
=>
[
0
,
'db-nolag-01'
,
'/^db-nolag-01
\s
+0$/m'
],
'Some lag'
=>
[
42
,
'db-somelag-02'
,
'/^db-somelag-02
\s
+42$/m'
],
'Not replicating'
=>
[
false
,
'db-not-replicating-03'
,
'/db-not-replicating-03
\s
+replication stopped or errored$/m'
],
];
}
/**
* @dataProvider provideLagTimes
*/
public
function
testReportedOutput
(
$lag
,
$servername
,
$expected
)
{
$lb
=
$this
->
createMock
(
ILoadBalancer
::
class
);
$lb
->
method
(
'getLagTimes'
)->
willReturn
(
[
$lag
]
);
$lb
->
method
(
'getServerName'
)->
willReturn
(
$servername
);
$this
->
setService
(
'DBLoadBalancer'
,
$lb
);
$this
->
maintenance
->
setOption
(
'-r'
,
false
);
$this
->
maintenance
->
execute
();
$this
->
maintenance
->
setOption
(
'-r'
,
true
);
$this
->
maintenance
->
stopReporting
=
true
;
$this
->
maintenance
->
execute
();
$this
->
expectOutputRegex
(
$expected
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 03:14 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7a/0a/a29b6dd0947e062667f9a4d32cd1
Default Alt Text
DatabaseLagTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment