CC: | ilmari [...] ilmari.org, peter [...] sysnix.com |
Subject: | Reproducible (albeit intermittent, roughly 7/10) failure on cleanup |
Attached is the smallest reproducible script I could put together. There are two failures in one here:
- If the last END line is commented out - the teardown takes considerably longer, with an error message (likely due to the peculiarity that the last statement perl sees is executed in ${^GLOBAL_PHASE} eq 'DESTRUCT')
- If however the last END line is uncommented, the teardown is speedy, but the exit status ($?) often ends up being 6, causing test harnesses to interpret successfu tests as failure.
This reliably fails on various perl/DBD versions. My test RBMS is
ii postgresql-9.1 9.1.18-0+deb7u1 amd64
Cheers!
Subject: | test_pgsql_cleanup_failure.t |
use strict;
use warnings;
use Test::PostgreSQL;
my $t_pg = Test::PostgreSQL->new;
my $dbh = DBI->connect(
$t_pg->dsn,
undef,
undef,
{ RaiseError => 1, AutoCommit => 1 }
);
$dbh->do('SET client_min_messages=warning');
$dbh->do('CREATE TABLE _test_foo (
pk SERIAL PRIMARY KEY,
bar VARCHAR(10)
)');
$dbh->do( 'ALTER TABLE _test_foo RENAME TO _test_fluff' );
# If this is the last statement in the file - things hang for a bit and
# then `Pg refused to die gracefully; killing it violently.` happens
$dbh->selectall_arrayref( 'SELECT * FROM _test_fluff' );
# If however this line is uncommented, by essentially delayin the $t_pg
# destruction - we get a 7-out-of-10 non-0 exit :/
END { my $dummy = $t_pg }