-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto testing of migrations #618
Conversation
1c5cfe9
to
5658641
Compare
I love the ideas presented in this PR, but I wonder if this is trying to do too much, mainly around the UpgradeTester class. Looking at this class I don't have a good intuition around how this will evolve over time as schemas evolve. Maybe we could start out by establishing the goals of this PR? For example, ensuring linear migration history seems great. Another might be that upgrades and downgrades of each revision are applied successfully and that the schema after upgrade + downgrade is unchanged. Maybe a test that checks that the schema generated by migrations matches the dev schema? If we did want to go to the point of checking data consistency after each upgrade, a dedicated/static test generated for each migration might be easier to maintain in the long run because it would only need to cover a specific migration and not worry about a changing data model. But even that feels like it could be an outside amount of work for the value. |
The |
5658641
to
05f09da
Compare
Thanks for the clarification, that makes more sense than my initial read. I think this is a good approach. In general, I assume we'd only expect to write migration test when we're updating existing schemas but not necessarily for additive migrations? |
Yes that's reasonable. We can add an array of "ignorable" migrations that get filtered out once that becomes an issue. |
05f09da
to
8bda819
Compare
01e111d
to
9006d6b
Compare
9006d6b
to
ee4b08b
Compare
ee4b08b
to
7b2e65c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I just read through the code, and this all makes sense. It definitely feels like a lot more work to write migrations because we also have to test them, but also they should be much more robust after this.
Automatically test all (new) migrations.
This is a WIP for initial review. I'd forgotten what a pain in the ass it is to write these kinds of tests, so I wanted to get a sensibility check before I finished.
fixes #555