zonkyio / embedded-postgres

Java embedded PostgreSQL component for testing
Apache License 2.0
344 stars 43 forks source link

Allow running under root on Linux when unshare is available #39

Closed jameshilliard closed 4 years ago

jameshilliard commented 4 years ago

I've reworked the unshare parts from #23 so that we test once on initialization that unshare is useable when running as root on Linux. This should avoid any cryptic errors when unshare is unavailable.

I've also reworked the runner to execute the postgres binary directly as opposed to being backgrounded by pg_ctl. This has the advantage of preventing orphan postgres in the event that cleanup fails as the postgres process should effectively be a child of the java module which would get killed at the same time as the java module.