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

The database returned by GetTestDatabase is dirty if a test has already been run. #13

Closed
kvhc308 opened this issue May 16, 2023 · 3 comments

Comments

@kvhc308
Copy link

kvhc308 commented May 16, 2023

I'm running integresql and pg via docker compose. I've initialized my db template and run migrations, all good so far.

Now that I have a template hash, I run my unit test (simple insert)

  • GetTestDatabase
  • Insert single entry in one of the tables
  • ReturnTestDatabase

Now when I run the same test again, the database is not clean. Its seems the database is not properly destroyed when returned?
Am I supposed to use transactions to keep the databases clean? Or manually truncate tables.
Any help would be appreciated.

@kvhc308
Copy link
Author

kvhc308 commented May 16, 2023

Duplicate of #2

I wrongly assumed ReturnTestDatabase would reset it.

@bimusiek
Copy link

I have also stumbled across the same problem. I was expecting the database to be cleaned and then send back to the pool.
No problem doing this by ourselves, however the documentation was misleading.

majodev added a commit that referenced this issue Jan 29, 2024
@majodev
Copy link
Member

majodev commented Jan 30, 2024

Closed via #16

@majodev majodev closed this as completed Jan 30, 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

No branches or pull requests

3 participants