1. Michael Granger
  2. ruby-pg
  3. Issues


Issue #18 resolved

improved spec test database setup

Lars Kanis
created an issue

The current setting up of the test database for running specs has imho some drawbacks:

  • pg_ctl hangs and createdb fails on Ubuntu 9.10

  • it takes minutes to init the db on a netbook for every single test

  • the log file is deleted at the end of the tests

Attached you can find some small changes that hopefully work on a wide range of systems out of the box.

Comments (4)

  1. Michael Granger repo owner
    • changed status to open
    • changed version to 0.8.0

    Thanks, I'll check out your patch! I want to be sure that the database is in a known pristine state before each spec, but I'm not sure a complete 'initdb' is necessary to ensure that. While it'd be nice if the specs ran fast on a netbook, IMO it's not worth the integrity of the specs, you know?

    The pg_ctl command hangs on Ubuntu because it can't write a lockfile to /var/run/postgres, which I guess is part of the package. I assume you've discovered some way of making it behave.

    Anyway, thanks again, and I'll look it over later today.

  2. Lars Kanis reporter

    Thanks for your fast answer. The initdb-call takes 90% of the time for setting up the test db. So it's maybe a good way to just drop and recreate the 'test' database for each test. This is what the second attached patch does.

    Yes, pg_ctl hangs because of missing permissions to create the lock and unix socket files. This is solved by the option -k. Moreover it has problems to recognize that the postgres process is up and running. This is solved by using PGHOST and PGPORT instead of command line parameters.

  3. Log in to comment