Page MenuHomePhabricator

ApiUploadTest is flaky
Closed, ResolvedPublic

Description

Author: neilk

Description:
multiple runs of ApiUploadTest have different results. Sometimes they succeed, sometimes fail.

Oddly, printing debug information seems to make the errors more elusive.

Arguably ApiUploadTest is done wrong; it should open up a real HTTP connection rather than elaborately simulating an API request.


Version: unspecified
Severity: normal

Details

Reference
bz26169
Related Gerrit Patches:
mediawiki/core : masterRework ApiUploadTest
mediawiki/core : masterMake `ApiUploadTest` up to date so it passes

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:24 PM
bzimport set Reference to bz26169.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Nov 30 2010, 5:29 AM
demon added a comment.Nov 30 2010, 6:07 PM

Is this actually in wikimedia-deployment, or on trunk?

I wouldn't trust any of the unit tests to run on deployment, lots of unmerged changes there.

the purpose of ApiUploadTest is not to test the actual upload so much as the code path handling the API upload. Requiring the test to use an actual web server would mean the tests couldn't be used by as many people.

Is this still an issue?

Antoine is going to remove this test from the default group of tests. I'm unassigning this from him for now. Whoever takes this on probably needs to set up mock objects and other mechanisms to avoid this unreliability in testing.

hashar added a comment.Feb 6 2012, 9:40 PM

Disabled with r110790

Krinkle added subscribers: hashar, Krinkle.EditedJan 12 2017, 9:59 PM

Disabled with rSVN110790

ApiUploadTest is still in @group Broken in current master.

Restricted Application added a project: Multimedia. · View Herald TranscriptJan 12 2017, 9:59 PM
Krinkle renamed this task from ApiUploadTest is flaky -- inconsistent results to ApiUploadTest is flaky.Jan 12 2017, 10:00 PM
demon removed a subscriber: demon.Mar 9 2017, 9:38 PM

Change 379817 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/core@master] Make ApiUploadTest up to date so it passes

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

Krinkle removed a subscriber: Krinkle.Sep 22 2017, 6:53 PM

Change 379817 merged by jenkins-bot:
[mediawiki/core@master] Make ApiUploadTest up to date so it passes

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

Anomie added a subscriber: Anomie.

(nothing useful for that tag in the merged patch)

Ramsey-WMF moved this task from Untriaged to Triaged on the Multimedia board.Nov 28 2017, 8:37 PM

Suggestions:

  • Get rid of RandomImageGenerator. Tests should be reproducible. Just use files from tests/phpunit/data/media instead.
  • In testUploadChunks(), don't download a multi-megabyte file from commons and then upload to the wiki, that's slow. Just override $wgMinUploadChunkSize and set the chunk size to 200 or something, then a tiny file from tests/phpunit/data/media can be uploaded in chunks.
  • Don't litter the wiki's actual upload directory with test files. Make a RepoGroup that points to a temporary directory.
  • Put teardown in tearDown() not in test methods after assertions are done. Destroy the whole temporary directory.
Restricted Application added a project: Core Platform Team. · View Herald TranscriptJul 26 2019, 4:28 AM
daniel added a subscriber: daniel.

Tagging CPT for fixing the test as suggested by time above. The fact that this test was disabled caused a bug to slip by which resulted in T231488: UploadFromChunks.php: Call to undefined method MediaWiki\FileBackend\FSFile\TempFSFileFactory::getTempFSFile().

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:12 PM

Change 533283 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] Rework ApiUploadTest.

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

Change 533283 merged by jenkins-bot:
[mediawiki/core@master] Rework ApiUploadTest

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

Pchelolo closed this task as Resolved.Sep 3 2019, 3:03 PM