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
feat(dp): migration tests framework + poc test #12591
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the Python Format Check after the last commit. |
a05c6b6
to
b46069e
Compare
class Testb0cad5321c88TestCase(AlembicTestCase): | ||
|
||
def setUp(self) -> None: | ||
super().setUp() |
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.
It is possible to create different kind of test:
- specify some data before migration (that would be some records in the database)
- specify expected data after migration
For example suppose that we have the following table:
CREATE TABLE T (ID INT);
And the following records:
INSERT INTO T VALUES(1);
INSERT INTO T VALUES(2);
now when we execute the following migration:
ALTER TABLE T ADD COLUMN A INT;
UPDATE T SET A = ID;
then we should get the following result:
SELECT * FROM T
ID, A
1, 1
2, 2
So the question is can we do it with this version of a framework?
Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
* feat(dp): migration tests framework + poc test Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * fix alembic configuration Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> Co-authored-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
Signed-off-by: Wojciech Sadowy wojciech.sadowy@freedomfi.com
feat(dp): migration tests framework + poc test
Summary
Added AlembicTestCase allowing to test python migrations, check database state before and after the migration, test individual tables etc.