While working on https://gitlab.wikimedia.org/repos/mediawiki/services/ipoid/-/merge_requests/200, I noticed that if I ran the test I was writing last, it would fail but if I ran it before other tests it would succeed (and other tests would fail instead). This suggests our integration pipeline tests have side effects. The order in which the tests are run affect subsequent tests (since they operate on the same database). We should have proper setup/teardown scripts so that each test is run in better isolation.
Description
Description
Related Objects
Related Objects
- Mentioned Here
- T416623: Decommission NodeJS IPoid service
Event Timeline
Comment Actions
This should be done for import-state.test.js which runs:
// Reset between tests
beforeEach( async function () {
// Initial import. Import scripts assume that the initial import was successful and
// only manage errors in updates.
await exec( './main.sh --init true --today 19990101_fake --debug true --batchsize 1' );
} );
// Tear down database after test
after( async function () {
await initDb.init( true );
} );But we should look at the other test files and make sure they clean up after themselves as well.