Last modified: 2013-06-17 14:31:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42491, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40491 - filebackend tests should use their own $wgFilebackends configuration
filebackend tests should use their own $wgFilebackends configuration
Status: NEW
Product: MediaWiki
Classification: Unclassified
Unit tests (Other open bugs)
1.19.1
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-24 21:52 UTC by Niklas Laxström
Modified: 2013-06-17 14:31 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2012-09-24 21:52:58 UTC
Example:

3) FileBackendTest::testStore with data set #2 (array('store', '/tmp/unittests_57b55ccf5688-1.txt', 'mwstore://localtesting/unittest-cont1/e/fun/obj1.txt', true), '/tmp/unittests_57b55ccf5688-1.txt', 'mwstore://localtesting/unittest-cont1/e/fun/obj1.txt')
fopen(/www/w/images/lockdir/khsf3ntb7why6dhpaq76lvaw45uil3u.lock): failed to open stream: Permission denied

/www/dev.translatewiki.net/w/includes/filebackend/lockmanager/FSLockManager.php:123
/www/dev.translatewiki.net/w/includes/filebackend/lockmanager/FSLockManager.php:74
/www/dev.translatewiki.net/w/includes/filebackend/lockmanager/LockManager.php:77
/www/dev.translatewiki.net/w/includes/filebackend/lockmanager/LockManager.php:173
/www/dev.translatewiki.net/w/includes/filebackend/FileBackend.php:966
/www/dev.translatewiki.net/w/includes/filebackend/FileBackendStore.php:516
/www/dev.translatewiki.net/w/includes/filebackend/FileBackend.php:682
/www/dev.translatewiki.net/w/tests/phpunit/includes/filerepo/FileBackendTest.php:1851
/www/dev.translatewiki.net/w/tests/phpunit/includes/filerepo/FileBackendTest.php:1837
/www/dev.translatewiki.net/w/tests/phpunit/includes/filerepo/FileBackendTest.php:202
/www/dev.translatewiki.net/w/tests/phpunit/MediaWikiTestCase.php:84
/www/dev.translatewiki.net/w/tests/phpunit/MediaWikiPHPUnitCommand.php:45
/www/dev.translatewiki.net/w/tests/phpunit/phpunit.php:107


I think it should use temporary folder for these tests.
Comment 1 Sam Reed (reedy) 2012-09-24 21:54:39 UTC
What are the perms for the lockdir?
Comment 2 Niklas Laxström 2012-09-24 22:52:21 UTC
drwxr-sr-x  2 www-data betawiki 4,0K 2012-09-16 19:31 ./
Comment 3 Antoine "hashar" Musso (WMF) 2012-09-25 07:36:02 UTC
I guess /www/w/images/lockdir/ should be fixed to be group writable or you will get the same issue with any maintenance script using the filebackend unless they are being run under the www-data user account.

About the test suite itself, we should probably override the $wgFilebackend stuff with a custom configuration using /tmp as root.  We could also attempt to mock the filesystem as described on http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mocking-the-filesystem but that will add yet another layer.

Rephrased subject.
Comment 4 Niklas Laxström 2012-09-25 23:55:36 UTC
Failing tests are not an enhancement imho.
Comment 5 Krinkle 2012-09-26 05:45:49 UTC
Does using wgFilebackend fix the failure Niklas showed in comment 0?

Looks like a permissions issue. Is it a valid requirement that the "lockdir/" in uploaddir is writeable? If so, then this bug is invalid (or an enhancement to show the error earlier). If it shouldn't use "/lockdir" there but elsewhere, then what should it use, and does that make it work?
Comment 6 Antoine "hashar" Musso (WMF) 2012-09-26 06:26:18 UTC
(In reply to comment #4)
> Failing tests are not an enhancement imho.

They are failing because of a well known permission issue: your cli script and apache process have different user and are probably not in the same group and not having umask 0002. So yeah that is mostly a local issue, the enhancement would be to make the test work on such setup.
Comment 7 Niklas Laxström 2012-09-26 17:49:15 UTC
The tests should just override the lockdir location to a temporary location. MediaWiki shouldn't assume that writable upload directory is configured by default.

Looks like lockdir comes from Setup.php:

132-$wgLockManagers[] = array(
133-    'name'          => 'fsLockManager',
134-    'class'         => 'FSLockManager',
135:    'lockDirectory' => "{$wgUploadDirectory}/lockdir",
136-);
Comment 8 Niklas Laxström 2013-06-17 14:31:21 UTC
I ran core tests yesterday and didn't see failures related to this.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links