r96924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96923‎ | r96924 | r96925 >
Date:22:18, 12 September 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
Use a username different from the main BlockTest.php, otherwise concurrency errors occur (as seen on Jenkins builds)
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/api/ApiBlockTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiBlockTest.php
@@ -15,11 +15,11 @@
1616 }
1717
1818 function addDBData() {
19 - $user = User::newFromName( 'UTBlockee' );
 19+ $user = User::newFromName( 'UTApiBlockee' );
2020
2121 if ( $user->getId() == 0 ) {
2222 $user->addToDatabase();
23 - $user->setPassword( 'UTBlockeePassword' );
 23+ $user->setPassword( 'UTApiBlockeePassword' );
2424
2525 $user->saveSettings();
2626 }
@@ -29,10 +29,10 @@
3030
3131 $data = $this->getTokens();
3232
33 - $user = User::newFromName( 'UTBlockee' );
 33+ $user = User::newFromName( 'UTApiBlockee' );
3434
3535 if ( !$user->getId() ) {
36 - $this->markTestIncomplete( "The user UTBlockee does not exist" );
 36+ $this->markTestIncomplete( "The user UTApiBlockee does not exist" );
3737 }
3838
3939 if( !isset( $data[0]['query']['pages'] ) ) {
@@ -45,15 +45,15 @@
4646
4747 $data = $this->doApiRequest( array(
4848 'action' => 'block',
49 - 'user' => 'UTBlockee',
 49+ 'user' => 'UTApiBlockee',
5050 'reason' => 'Some reason',
5151 'token' => $pageinfo['blocktoken'] ), $data );
5252
53 - $block = Block::newFromTarget('UTBlockee');
 53+ $block = Block::newFromTarget('UTApiBlockee');
5454
5555 $this->assertTrue( !is_null( $block ), 'Block is valid' );
5656
57 - $this->assertEquals( 'UTBlockee', (string)$block->getTarget() );
 57+ $this->assertEquals( 'UTApiBlockee', (string)$block->getTarget() );
5858 $this->assertEquals( 'Some reason', $block->mReason );
5959 $this->assertEquals( 'infinity', $block->mExpiry );
6060

Comments

#Comment by Krinkle (talk | contribs)   22:20, 12 September 2011

Example (from before this commit):

http://ci2.tesla.usability.wikimedia.org:8080/job/MediaWiki-phpunit/472/

ApiBlockTest::testMakeNormalBlock
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-Some reason
+Parce que

/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/includes/api/ApiBlockTest.php:57
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/MediaWikiTestCase.php:60
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/MediaWikiPHPUnitCommand.php:31
/var/lib/jenkins/jobs/MediaWiki-phpunit/workspace/mw-core/tests/phpunit/phpunit.php:60
#Comment by 😂 (talk | contribs)   23:33, 12 September 2011

FWIW, the concurrency issue shouldn't happen. Ideally, we need to find the underlying issue. [https://bugzilla.wikimedia.org/show_bug.cgi?id=29612 BUg 29612] has some background on this.

Status & tagging log