-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Hi there thanks for such a great lib
We have been using H2 for our test suite and we are planning to migrate to TestContainer only problem is that we have some test cases especially the ones that involving @Async blocks within that when executed it pollutes the database records so we used to backup the database in a @BeforeEach and then restore it back in an @AfterEach
Doing so in H2 was pretty easy and fast using SCRIPT TO scriptPath in @BeforeEach and DROP ALL OBJECTS, RUNSCRIPT FROM scriptPath in @AfterEach
I was trying to do the same idea some stuff like
@BeforeEach > postgreSQLContainer.execInContainer("pg_dump", "-U" , "test" , "-w" , "-Fc","-d", "test", "-f", "/tmp/backup");
@AfterEach > postgreSQLContainer.execInContainer("pg_restore","-U", "test", "-w","--clean", "--dbname=test", "/tmp/backup");
but was left facing locking problems and eliminating these locks will terminate the test context
I also tried separate container per test but it takes alot of time
Any idea how to overcome such a problem
Note, This is not a bug in test container but it might be a feature request