tmp-postgres: Start and stop a temporary postgres for testing
This module provides functions creating a temporary postgres instance on a random port for testing.
result <- start []
case result of
Left err -> print err
Right tempDB -> do
-- Do stuff
stop tempDBThe are few different methods for starting postgres which provide different
methods of dealing with stdout and stderr.
The start methods use a config based on the one used by pg_tmp (http:/ephemeralpg.org), but can be overriden by different values to the first argument of the start functions.
MacOS and Linux are support. Windows is not.
Requires PostgreSQL 9.3+
WARNING!!
Ubuntu's PostgreSQL installation does not put initdb on the PATH. We need to add it manually. The necessary binaries are in the /usr/lib/postgresql/VERSION/bin/ directory, and should be added to the PATH
echo "export PATH=$PATH:/usr/lib/postgresql/VERSION/bin/" >> /home/ubuntu/.bashrc
[Skip to Readme]
Downloads
- tmp-postgres-0.2.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates