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