Page MenuHomePhabricator

Db error "Duplicate entry TestNewSystemUser … for key actor_name" (via UserTest)
Closed, ResolvedPublic

Description

This is blocking the re-enablement of the "assert no runtime errors" step in CI, which checks that mw-error.log remains empty. This was accidentally removed a few months ago (T246358).

mw-dberror.log
Fri Mar 20 18:11:23 UTC 2020	32a44f17c9c0	wikidb-unittest_	User::updateActorId	localhost:/workspace/db/quibble-mysql-fyqd_1b0/socket	1062	Duplicate entry 'TestNewSystemUser 81e504.1010' for key 'actor_name' (localhost:/workspace/db/quibble-mysql-fyqd_1b0/socket)	INSERT INTO `unittest_actor` (actor_user,actor_name) VALUES (169,'TestNewSystemUser 81e504.1010')
#0 /workspace/src/includes/libs/rdbms/database/Database.php(1580): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /workspace/src/includes/libs/rdbms/database/Database.php(1159): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /workspace/src/includes/libs/rdbms/database/Database.php(2242): Wikimedia\Rdbms\Database->query(string, string)
#3 /workspace/src/includes/libs/rdbms/database/Database.php(2223): Wikimedia\Rdbms\Database->doInsert(string, array, string)
#4 /workspace/src/includes/user/User.php(4259): Wikimedia\Rdbms\Database->insert(string, array, string)
#5 /workspace/src/includes/user/User.php(4149): User->updateActorId(Wikimedia\Rdbms\DatabaseMysqli)
#6 /workspace/src/includes/libs/rdbms/database/Database.php(4179): User::{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#7 /workspace/src/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#8 /workspace/src/includes/libs/rdbms/database/DBConnRef.php(641): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#9 /workspace/src/includes/user/User.php(4156): Wikimedia\Rdbms\DBConnRef->doAtomicSection(string, Closure)
#10 /workspace/src/includes/user/User.php(805): User::createNew(string, array)
#11 /workspace/src/tests/phpunit/includes/user/UserTest.php(2134): User::newSystemUser(string, array)
#12 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(1408): UserTest->testNewSystemUser(string, array, array, string)
#13 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(1028): PHPUnit\Framework\TestCase->runTest()
#14 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestResult.php(691): PHPUnit\Framework\TestCase->runBare()
#15 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(756): PHPUnit\Framework\TestResult->run(UserTest)
#16 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(418): PHPUnit\Framework\TestCase->run(PHPUnit\Framework\TestResult)
#17 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): MediaWikiIntegrationTestCase->run(PHPUnit\Framework\TestResult)
#18 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#19 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#20 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#21 /workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(621): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#22 /workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php(200): PHPUnit\TextUI\TestRunner->doRun(PHPUnit\Framework\TestSuite, array, boolean)
#23 /workspace/src/tests/phpunit/phpunit.php(71): PHPUnit\TextUI\Command->run(array, boolean)
#24 /workspace/src/maintenance/doMaintenance.php(99): PHPUnitMaintClass->execute()
#25 /workspace/src/tests/phpunit/phpunit.php(130): require(string)
#26 {main}

Event Timeline

Krinkle created this task.Mar 20 2020, 7:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2020, 7:08 PM
Restricted Application added a project: User-DannyS712. · View Herald TranscriptMar 20 2020, 7:25 PM

Change 582148 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] UserTest: Fix creating multiple system users with the same name

https://gerrit.wikimedia.org/r/582148

The patch should remove the failing test case

Anomie added a subscriber: Anomie.

The test case in question appears to be the "Anonymous actor but not reserved" case for UserTest::testNewSystemUser(), which is supposed to fail and we want to make sure it really does so. The test case was added in rMW685b50562809: User: Allow newSystemUser() to create over anonymous actors to make sure that the fix for T236444 did only what it was supposed to rather than being overly broad.

Sad if we have to avoid testing expected error edge cases.

DannyS712 removed DannyS712 as the assignee of this task.Mar 20 2020, 9:38 PM
DannyS712 added a subscriber: DannyS712.

The patch should remove the failing test case

Wrong test case identified, wrong approach

@Krinkle can you update the priority for this task?

Change 584036 had a related patch set uploaded (by Nikki Nikkhoui; owner: Nikki Nikkhoui):
[mediawiki/core@master] Set logger to null in UserTest.php

https://gerrit.wikimedia.org/r/584036

nnikkhoui triaged this task as High priority.Mar 27 2020, 7:52 PM

Change 584248 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] phpunit: Add setNullLogger() and make tests default to LegacySpi

https://gerrit.wikimedia.org/r/584248

Change 584248 merged by jenkins-bot:
[mediawiki/core@master] phpunit: Add setNullLogger() and make tests default to LegacySpi

https://gerrit.wikimedia.org/r/584248

Change 584036 merged by jenkins-bot:
[mediawiki/core@master] Set logger to null in UserTest.php

https://gerrit.wikimedia.org/r/584036

daniel closed this task as Resolved.Apr 8 2020, 9:08 AM