Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 61596
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: GAAS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.17.1
Fixed in: 2.18.0



Subject: t/04misc trace tests fail
Tests 40, 41 and 42 of t/04misc.t fails for me. The TAP output is: not ok 40 - Trace flag 'pglogin' works as expected with DBD::Pg->parse_trace_flag() # Failed test 'Trace flag 'pglogin' works as expected with DBD::Pg->parse_trace_flag()' # at t/04misc.t line 225. # got: 'Login connection string: # Connection complete # DESTROY for DBI::db=HASH(0xa3d7008) ignored - handle not initialised # Login connection string: # Connection complete # Disconnection complete # Login connection string: # Connection complete # DESTROY for DBI::db=HASH(0xa4961f8) ignored - handle not initialised # Login connection string: # Connection complete # Disconnection complete # ' # expected: 'Login connection string: # Connection complete # Disconnection complete # Login connection string: # Connection complete # Disconnection complete # ' and similar for test 41 and 42. I'm using DBD-Pg-2.17.1 and a remote test server with access set up using @ENV{"DBI_DSN", "DBI_USER", "DBI_PASS"}.
I tracked the problem to be that the connect_database() function in t/dbdpg_test_setup.pl ends up connecting twice to the database each time it's called. Once without passing in a password (which fails) and then it retries later with a password. I fixed it here with the attached patch when make the initial attempt at connecting also pass the password.
Subject: connect_database.patch
--- a/t/dbdpg_test_setup.pl +++ b/t/dbdpg_test_setup.pl @@ -88,7 +88,7 @@ sub connect_database { } goto GOTDBH if eval { - $dbh = DBI->connect($testdsn, $testuser, '', + $dbh = DBI->connect($testdsn, $testuser, $ENV{DBI_PASS}, {RaiseError => 1, PrintError => 0, AutoCommit => 1}); 1; };
Thanks, applied in 14454