Skip to content
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

Add DB migrations tests #899

Merged
merged 21 commits into from
Jul 6, 2023
Merged

Conversation

MV-GH
Copy link
Collaborator

@MV-GH MV-GH commented Jun 28, 2023

Adds DB migration tests.
Added it to woodpecker too.
The tests need the schemas thus they are included in git. (They were a PITA to get)
Btw why are we allowing queries on the main thread? @dessalines

Fixes #898

@MV-GH
Copy link
Collaborator Author

MV-GH commented Jun 28, 2023

@dessalines is it possible to get hardware acceleration in the pipeline? The migrations need to run as a instrumentation test which needs to run in a emulator which needs hardware acceleration to run. So I am unable to add this check to the CI.

@MV-GH
Copy link
Collaborator Author

MV-GH commented Jun 28, 2023

image
How is this passing?

@dessalines
Copy link
Member

dessalines commented Jun 29, 2023

@dessalines is it possible to get hardware acceleration in the pipeline?

I don't know if that android image supports it. God that's annoying that a full emulator is required just to test some migrations.

Btw why are we allowing queries on the main thread? @dessalines

iirc its necessary for synchronous queries, esp the getAllAccountsSync. You could test it without that on tho, and see if you get any errors.

@MV-GH
Copy link
Collaborator Author

MV-GH commented Jun 29, 2023

I don't know if that android image supports it. God that's annoying that a full emulator is required just to test some migrations.

All instrumentation tests will need it else it will take like 2 hours what would take 5minutes.
see this issue ReactiveCircus/android-emulator-runner#46

Well that check exists so what we dont do any DB queries on ui thread. If we are hitting that check we should instead fix the issue and not disable the check. I'll maybe look into it but that's not for this pr.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see the migration tests being run: https://woodpecker.join-lemmy.org/repos/137/pipeline/494/6

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I take it we'll need to remember to add these json files (which should be auto-generated), as part of the migration PR? I assume the lint will fail otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the schema of current version gets generated each time when run. This is needed for the migration test to compare the version after migration to the outputted schema of the actual DB.

@MV-GH
Copy link
Collaborator Author

MV-GH commented Jul 4, 2023

It is not possible to add the migration tests without hardware acceleration. Thus i removed them from CI. But i added comment that devs who add migrations should check it.

@dessalines
Copy link
Member

Gotcha. In that case I'm good with merging as is.

@dessalines dessalines enabled auto-merge (squash) July 5, 2023 15:49
@dessalines dessalines merged commit 4fc0912 into LemmyNet:main Jul 6, 2023
@MV-GH MV-GH deleted the feat/add-migrations-test branch July 11, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DB migration tests
2 participants