zapodot/embedded-db-junit

DB not reset after the test

victornoel opened this issue · 5 comments

When using an EmbeddedDatabaseRule as a @Rule, I would expect to have a fresh empty database for each test of my test class, but apparently, it is the same database used in all of the tests.

I guess the problem is that h2 does keep the database in memory even if you close the connection.

In theory it should make a new database for every test unless you add a name to the DataSource explicitly using the fluent builder. I will add some tests to find out what's happening here. Thx for reporting 👍

Actually I am using a name in the fluent builder :)

So you should probably stop doing that :-)

  1. nov. 2016 6.18 p.m. skrev "Victor Noël" notifications@github.com:

Actually I am using a name in the fluent builder :)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAhqkQXmyQ1bghylcoLaAvRN7Y6X7VFKks5q-JfLgaJpZM4KtWZT
.

I will need to find an alternative, because the thing I am testing is taking the jdbc url from a file, so I thought (until now, I will look if I can) that I had to choose a fixed name for the h2 in-memory database.

I guess this issue could be closed? Or maybe this could be documented before it is... Thanks :)

I managed to make it work as expected :)