Make integration-test migration replay fail closed
0 viewsAbout 1 min read
Make integration-test migration replay fail closed
If an integration test cannot create its schema but continues into entity tests, the delayed failures lose the original cause. A missing migration directory, zero SQL files, a read error, or one failed statement is a bootstrap failure.
Safe replay rules
- Throw immediately when the repository SSOT directory cannot be found.
- Do not treat a directory with no SQL files as success.
- Read sorted SQL files as UTF-8 and stop at the first execution error.
- Apply the same rule to seeds; an applied-count log is not proof of success.
This contract distinguishes “the test ran” from “the test ran against the real schema.” Migration idempotency is a separate concern; the test harness must first refuse to hide failure.
Related course: Close partial failure, recovery, and platform boundaries