Tests: Fix database cleaner separation #676
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #647, we noticed that our unit tests were failing in the pipeline (GitHub Actions). We noticed locally that the database is not fully cleaned and there are users left between tests. We now use the slower
deletion
strategy which will entirely delete the tables since transactions was not working for us. This might be due toafter_commit
orafter_save
callbacks as discussed here.Note that for the deletion strategy, we also tried out to set
pre_count
andreset_ids
totrue
as described here, but this made the tests slower, so we will omit those options.For a discussion on delete vs. truncate, see this StackOverflow answer.
Note that this PR was opened after a long night session were Denis and I both tried to dig down deep. We hope this PR doesn't break anything 😅 But it shouldn't and if it does, then only our tests.