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

Record does not get deleted in on_exit callback #49

Open
aus70 opened this issue Sep 29, 2017 · 2 comments
Open

Record does not get deleted in on_exit callback #49

aus70 opened this issue Sep 29, 2017 · 2 comments

Comments

@aus70
Copy link

aus70 commented Sep 29, 2017

Within a ExUnit test, I use an on_exit callback to cleanup the database after testing:

IO.inspect(My.Account |> My.Repo.all) # shows a record
My.Account
|> Ecto.Query.where(my_id: ^my_id)
|> My.Repo.delete_all
IO.inspect(My.Account |> My.Repo.all) # shows []

After testing, I run iex - S mixand then My.Account |> My.Repo.all, which still shows the same record. Is this result to be expected? Why doesn't the record get deleted? Am I missing anything?

My best guess is that the delete does not get synced to disk. If this is the case, is there an idiomatic way to force the sync?

Thanks!

@AndrewDryga
Copy link
Member

Are you sure that this is exactly the same account? It could bethat you have different mnesia paths for iex and test environments, so you see two different databases.

@aus70
Copy link
Author

aus70 commented Oct 6, 2017

Yes, it was. I have now a path for each environment (dev, test, production) and I wipe all tables before the tests. I couldn't solve the original problem, but now I can live with it.

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

No branches or pull requests

2 participants