allaboutapps / integresql

IntegreSQL manages isolated PostgreSQL databases for your integration tests.

Home Page:https://hub.docker.com/r/allaboutapps/integresql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kvhc308 opened this issue · comments

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.

Duplicate of #2

I wrongly assumed ReturnTestDatabase would reset it.

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.