1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
use MediaWiki\Logger\LoggerFactory;
/**
* @group FileRepo
* @group FileBackend
* @group medium
* @covers FileBackendMultiWrite
*/
class FileBackendMultiWriteIntegrationTest extends FileBackendIntegrationTestBase {
protected function getBackend() {
$tmpDir = $this->getNewTempDirectory();
$lockManagerGroup = $this->getServiceContainer()
->getLockManagerGroupFactory()->getLockManagerGroup();
return new FileBackendMultiWrite( [
'name' => 'localtesting',
'lockManager' => $lockManagerGroup->get( 'fsLockManager' ),
'parallelize' => 'implicit',
'wikiId' => 'testdb',
'logger' => LoggerFactory::getInstance( 'FileOperation' ),
'backends' => [
[
'name' => 'localmultitesting1',
'class' => FSFileBackend::class,
'containerPaths' => [
'unittest-cont1' => "{$tmpDir}/localtestingmulti1-cont1",
'unittest-cont2' => "{$tmpDir}/localtestingmulti1-cont2" ],
'isMultiMaster' => false
],
[
'name' => 'localmultitesting2',
'class' => FSFileBackend::class,
'containerPaths' => [
'unittest-cont1' => "{$tmpDir}/localtestingmulti2-cont1",
'unittest-cont2' => "{$tmpDir}/localtestingmulti2-cont2" ],
'isMultiMaster' => true
]
]
] );
}
protected function assertBackendPathsConsistent( array $paths, $okSyncStatus ) {
$status = $this->backend->consistencyCheck( $paths );
if ( $okSyncStatus ) {
$this->assertStatusGood( $status, "Files synced: " . implode( ',', $paths ) );
} else {
$this->assertStatusNotOK( $status, "Files not synced: " . implode( ',', $paths ) );
}
}
}
|