Enforce fixtures for new tables
Summary
Currently adding Development seed files is ad-hoc and new DB tables can be added without a database fixture.
The issue is to enforce seed file for each new table that's being added.
Benefits:
- Ease of seeding the feature for testing. See - #444461 (comment 1823691697) "In many cases we now have to do complicated setup to try a some feature, and for those that don't have much context around the given feature it could be confusing. While development/test/review engineers have to go through this setup anyway, so why not just script it once and reuse it"
- Expanded data seeding for multi-version upgrade testing. To catch migration errors in upgrade testing, we need to have all tables seeded with various data to achieve best coverage. Related to Expand data seeding configuration for multi-ver... (gitlab-org/quality/quality-engineering/team-tasks#2354 - closed)
Potential challenges:
- Handling split work - we often have MRs that introduce just the DB changes (e.g. new table), and the code that is using it comes in a later MR (#444461 (comment 1823691697)). To mitigate this we may require fixtures only when there are both table and model present.
- Additional step in developing a feature
Action items
- Discuss proposal and agree on approach - #444461 (comment 1830772819)
✅ - Implement the enforcement check
- Announce that required is added
Implementation Proposal
Proposed implementation per #444461 (comment 1821818153):
- Add a check that would map output of the exiting seed fixtures jobs like -
gitlab-setup
andrun-dev-fixtures-ee
- to all existing tables, to list which tables are not seeded as part of thedb:seed_fu
. Example PostgreSQL query mentioned in gitlab-org/quality/quality-engineering/team-tasks#2354 (comment 1825939777)- Create rake task that will check that each table name in
db/docs
files is seeded with fixtures, add option to list excluded tables (that don't have fixtures and still need to be added), add CI job for the rake task, make it required to pass, maintain list of excluded files, add documentation/guidance on how to keep this up-to-date/maintain script
- Create rake task that will check that each table name in
- Update the "Adding new tables" review docs
Edited by Nailia Iskhakova