Closed dmoebius closed 2 years ago
Could you please describe your test scenarios in more detail? Does it mean that you access a test database from a shutdown hook? Because in normal use you should only access the test database within test methods, or possibly also within before or after test callbacks. You should definitely not rely on the execution order of shutdown hooks.
We are using HikariCP as database connection pool. Hikari has it's own shutdown hook. Since we cannot control the order of shutdown hooks, very often the EmbeddedPostgres
shuts down first, which causes Hikari to throw many "not available" exceptions during shutdown, This is annoying and confuses our developers and testers.
We are not only using EmbeddedPostgres
in JUnit-Tests, but also during development when running the application locally and interactively. The application is stopped using Ctrl-C on a terminal. We don't have a clean way to stop Hikari before stopping the rest of the application.
Sorry for the late response. However, this library is intended for testing-only purposes. So it should be used only for running unit or integration tests. Using it for running the application is neither intended nor supported, even during development. Thanks for your understanding.
EmbeddedPostgres
always sets its own shutdown hook in methodstartPostmaster()
:This gives us some problems in some test scenarios, where we don't have control of the order of shutdown hooks. Could you please add an option to disable the shutdown hook, e.g.
Thanks.