Subject: | Test scripts do not allow specification of lock file directory |
The test scripts "01-raii.t" and "02-multi.t" try to start an instance
of PostgreSQL. On Debian Linux (and many Debian-based distributions,
like Ubuntu), the PostgreSQL packages will write their lock files to
/var/run/ by default, and non-privileged users (i.e. not "postgres" or
"root") do not typically have write access to this directory. This
causes test errors like the following.
t/01-raii.t ....... failed to launch postgresql: at
/home/cww/.cpan/build/Test-postgresql-0.03-0qr8Iy/blib/lib/Test/postgresql.pm
line 95.
t/01-raii.t ....... Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
Here's the summary from one such test run.
Test Summary Report
-------------------
t/01-raii.t (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1
Parse errors: No plan found in TAP output
t/02-multi.t (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1
Parse errors: No plan found in TAP output
Files=4, Tests=4, 230 wallclock secs ( 0.04 usr 0.02 sys + 52.12 cusr
89.58 csys = 141.76 CPU)
Result: FAIL
Failed 2/4 test programs. 0/4 subtests failed.
make: *** [test_dynamic] Error 255
An example postgres.log is as follows.
FATAL: could not create lock file
"/var/run/postgresql/.s.PGSQL.15531.lock": Permission denied
If I add my user to the "postgres" group, which owns
/var/run/postgresql, the tests pass. However, I feel that this should
not be required, as it may be difficult for some developers to have
their development accounts added to a system group, per local IT policy
and other such things.
Ideally, the lock file will be created in the temporary database
directory created by Test::postgresql or in the system temporary directory.