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

WIP: Fix sandbox not clearing after each test #316

Closed

Conversation

jauggy
Copy link
Member

@jauggy jauggy commented Jun 9, 2024

Context

If I create a user in test 1, it should be cleared after the test ends and then when I try to create the same user in test 2, it should work. If the sandbox db is not cleared and you try and create a user with a name that already exists, instead it creates a user with random name.

Test Steps

mix test path/to/clear_db_each_test.exs

All tests should pass

TODO

Currently the tests fail and not sure how to fix

fail.mp4

Update clear_db_each_test.exs
@geekingfrog
Copy link
Contributor

geekingfrog commented Jun 26, 2024

I found the issue and added a fix in #342
If you want to verify that, you can cherry pick the only commit of this PR (git cherry-pick 8cc544e7eaf7e8e0627611e3d784dc88e08ab63c on this branch) and run this test again.

The problem was that the DB was correctly reset between tests, but the cache wasn't. I don't think my fix is going to solve all cache issues but that's a start.

I don't want to have this PR merged though, since this is merely a test file to reproduce an issue, I think a better place to surface these problem would be a github issue. The code sample was very useful to debug it.

@jauggy
Copy link
Member Author

jauggy commented Jun 27, 2024

@geekingfrog did you link the wrong PR?

@geekingfrog
Copy link
Contributor

Oops, yes, I did. I amended my comment and put the correct link in place.

@jauggy jauggy closed this Jul 4, 2024
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.

2 participants