-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> So, I'm wondering how other driver maintainers deal with these
> types of issues. Surely there are parallels to the types of issues
> I have with MySQL.

Funny you should bring them up now, I've just been enhancing this
part of the tests for DBD::Pg. Basically, we use a slew of environment
variables: DBI_DSN, DBI_USER, etc. plus some Postgres-specific ones,
such as PGSYSCONFDIR, PGPORT, etc. If the first attempt at a connection
fails with a certain message, we try a default user 'postgres' and a
default database 'postgres'.

We dump out lots of input via diag at the start of the tests. If the
connection fails, we treat it as a skip, and also dump out the reason
why we failed. Successful output looks like this:

t/00-signature......skipped
        all skipped: Set the environment variable TEST_SIGNATURE to enable this 
test
t/00basic...........ok
t/01connect.........ok 1/15#
# DBI                   Version 1.602
# DBD::Pg               Version 2.0.0_3
# Perl                  Version 5.8.8
# OS                    linux
# PostgreSQL (compiled) 80206
# PostgreSQL (target)   80111
# PostgreSQL (reported) PostgreSQL 8.1.11 on i686-pc-linux-gnu, compiled by GCC 
gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
# Default port          5432
# DBI_DSN               dbi:Pg:
# DBI_USER              greg
# Test schema           dbd_pg_testschema
# PGDATABASE            pgtesting
# PGPORT                5581
# PGSYSCONFDIR          /home/greg
# DBI_DRIVER            Pg
# Adjusted:             DBI_DSN

Basically, we make a best effort to find a valid connection at the top of
each test that needs a database handle (most of them), and do a skip_all
if the connection fails. Most times, the automated tests do not find a
valid database connection, but that's the price of the automated testing:
we don't want to be too intrusive if they don't want to provide a database.

Some of the code:

http://svn.perl.org/modules/DBD-Pg/trunk/t/dbdpg_test_setup.pl

http://svn.perl.org/modules/DBD-Pg/trunk/t/01connect.t

Example non-connecting but passed test:

http://www.nntp.perl.org/group/perl.cpan.testers/2008/01/msg967763.html


- --
Greg Sabino Mullane [EMAIL PROTECTED]
End Point Corporation
PGP Key: 0x14964AC8 200801180014
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFHkDYOvJuQZxSWSsgRA9L0AKCkpn6YrLrYB0Rbh9dZNAvBJhlzogCg/aci
72+TZSJsocM39uZrWK4/Afc=
=sPiS
-----END PGP SIGNATURE-----


Reply via email to