http://www.perlmonks.org?node_id=1000207


in reply to Re: How to do automated tests of a database centric CPAN module
in thread How to do automated tests of a database centric CPAN module

Now that's interesting, I have not looked for temp PostgreSQL database creation since I would not have expected this to exist.

I would like to include tests using Test::postgresql besides the tests against in-memory SQLite (in case no other database has been specified, see my other posts). I hope the non-patched version works for me since my module would obviously need to reference something on CPAN. Thank you for pointing to your patched version on GitHub.

  • Comment on Re^2: How to do automated tests of a database centric CPAN module

Replies are listed 'Best First'.
Re^3: How to do automated tests of a database centric CPAN module
by erix (Prior) on Oct 21, 2012 at 11:45 UTC

    I believe Test::Database serves a similar purpose (create/drop temp databases).

      If I understood the documentation correctly, only DBMSs available in the current environment can be instantiated by using Test::Database, so it would not help in the current situation, but please correct me if I am wrong.

        That's true but in that it's not different from Test::postgresql, as far as I can see.

        From Test::postgresql docs:

        new [...] If required programs (initdb and postmaster) were not found, the function returns undef and sets appropriate message to $Test::postgresql::errstr.

        I think it's really only DBD::SQLite that will give you a complete package, from scratch.

        ( Probably one could create a package with all the bits to run a PostgreSQL instance from the binaries from the EnterpriseDB site [1], but that looks like quite an undertaking...:

        (cannot run as root) http://www.enterprisedb.com/products-services-training/pgbindownload "Binaries from installer version 9.2.1" -- to use, unzip the pgsql directory somewhere, and cd into it: cd pgsql -- run initdb: ./bin/initdb -D 9.2/data -- start postgres: ./bin/pg_ctl/ -D 9.2/data -l logfile start -- run tests... -- to stop, close all connections, then: ./bin/pg_ctl -D 9.2/data -l logfile stop -- cleanup all files Hm, I don't know - possible but error-prone, probably...
        )

        [1] http://www.enterprisedb.com/products-services-training/pgbindownload