Page MenuHomePhabricator

🔗 Include sitelinks in the contract test for GET /entities/items/{item_id}
Closed, ResolvedPublic

Description

Currently, the CI system does not allow creating an item with a sitelink. It fails with the following error:

18:12:22   1) validate GET /entities/items/{id} responses against OpenAPI document
18:12:22        200 OK response is valid for a non-empty item:
18:12:22      AssertionError: User "<anon>": Action "wbeditentity" returned error code "not-recognized-site": Unknown site: wikidb!
18:12:22       at Client.action (node_modules/api-testing/lib/actionapi.js:123:11)
18:12:22       at processTicksAndRejections (internal/process/task_queues.js:95:5)
18:12:22       at async Object.createSingleItem (tests/mocha/helpers/entityHelper.js:60:9)
18:12:22       at async Context.<anonymous> (tests/mocha/openapi-validation/GetItemTest.js:38:36)
18:12:22 
18:12:22 
18:12:22 
18:12:22 ERROR: "api-testing:rest-api" exited with 1.

In order to fully contract-test the response of GET /entities/items/{item_id} against the OpenAPI schema, we should find out how to create an item with a sitelink and include it in the test.

Event Timeline

Silvan_WMDE renamed this task from Include sitelink in the contract test for GET /entities/items/{item_id} to Include sitelinks in the contract test for GET /entities/items/{item_id}.Mar 16 2022, 10:39 AM

If we can't enable sitelinks in CI we could create separate sitelink test(s) that only run locally. For example, via an environment variable that is only set locally and mocha's if skip.

Looks like the hard part has been done in T314586 so testing sitelinks should be doable now.

Ollie.Shotton_WMDE renamed this task from Include sitelinks in the contract test for GET /entities/items/{item_id} to 🔗 Include sitelinks in the contract test for GET /entities/items/{item_id}.Sep 21 2022, 8:39 AM

Change 833781 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] REST: Include sitelinks in GET item spec test

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

Change 833781 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Include sitelinks in GET item spec test

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