[go: nahoru, domu]

Page MenuHomePhabricator

Remove race condition in api-testing/makeTag to enable parallel testing
Closed, ResolvedPublic

Description

The api-testing library has a makeTag function that is used in the Wikibase test suite as part of the end-to-end tests.

When the suite is run in a linear order, makeTag works fine. When the suite is run in parallel, it can be that two tests simultaneously try and make the same tag.

Make the api-testing package's makeTag function fail gracefully if the requested tag is already present, so that multiple tests can create the same tag in parallel without getting a failure.

Here is a patch where we attempt to enable parallel testing:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/1051106

and here is a failed run:
https://integration.wikimedia.org/ci/job/mediawiki-quibble-apitests-vendor-php74/10055/console

The errors are:

13:20:46   2 failing
13:20:46 
13:20:46   1) addPropertyAliasesInLanguage
13:20:46        20x success response 
13:20:46          can add aliases with edit metadata provided:
13:20:46      AssertionError: User "WikiAdmin": Action "managetags" returned error code "tags-create-already-exists": The tag "e2e test tag" already exists.!
13:20:46       at Client.action (node_modules/api-testing/lib/actionapi.js:123:11)
13:20:46       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
13:20:46       at async Object.makeTag (node_modules/api-testing/lib/action_clients.js:32:27)
13:20:46       at async Context.<anonymous> (tests/mocha/api-testing/AddPropertyAliasesInLanguageTest.js:68:16)
13:20:46 
13:20:46   2) addPropertyStatement
13:20:46        201 success response
13:20:46          can add a statement to a property with edit metadata:
13:20:46      AssertionError: User "WikiAdmin": Action "managetags" returned error code "tags-create-already-exists": The tag "e2e test tag" already exists.!
13:20:46       at Client.action (node_modules/api-testing/lib/actionapi.js:123:11)
13:20:46       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
13:20:46       at async Object.makeTag (node_modules/api-testing/lib/action_clients.js:32:27)
13:20:46       at async Context.<anonymous> (tests/mocha/api-testing/AddPropertyStatementTest.js:51:16)
13:20:46

Event Timeline

Change #1051309 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/tools/api-testing@master] Add `force` option to `makeTag` action

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

Change #1051311 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/tools/api-testing@master] Bump version to 1.6.1

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

Change #1051309 merged by jenkins-bot:

[mediawiki/tools/api-testing@master] Add `force` option to `makeTag` action

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

Change #1051311 merged by jenkins-bot:

[mediawiki/tools/api-testing@master] Bump version to 1.7.0

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

@Jdforrester-WMF Could you please publish the new version to NPM for us?

@Jdforrester-WMF Could you please publish the new version to NPM for us?

Done, though of course I don't own this code (the MediaWiki Interfaces team do), and you should normally ask them. :-)

Thank you! and good to know. Will ask them in future.