Fix test suite to work again with DBICTEST_SQLITE_USE_FILE
It was never included as part of POISON_ENV and subsequently lapsed. Sigh.
(cherry pick of 7154ff35)
Peter Rabbitson
9 years ago
88 | 88 |
# returned results, look through lib, find all mentioned ENVvars and
|
89 | 89 |
# set them to true and see if anything explodes
|
90 | 90 |
for var in \
|
|
91 |
DBICTEST_SQLITE_USE_FILE \
|
91 | 92 |
DBICTEST_SQLITE_REVERSE_DEFAULT_ORDER \
|
92 | 93 |
$(grep -P '\$ENV\{' -r lib/ --exclude-dir Optional | grep -oP '\bDBIC\w+' | sort -u | grep -v DBIC_TRACE)
|
93 | 94 |
do
|
15 | 15 |
|
16 | 16 |
cmp_ok(DBICTest->resultset('Artist')->count, '>', 0, 'count is valid');
|
17 | 17 |
|
18 | |
# cleanup globaly cached handle so we do not trigger the leaktest
|
19 | |
DBICTest->schema->storage->disconnect;
|
20 | |
|
21 | 18 |
done_testing;
|
60 | 60 |
);
|
61 | 61 |
is( $it->count, 1, "complex abstract count ok" );
|
62 | 62 |
|
63 | |
# cleanup globals so we do not trigger the leaktest
|
64 | |
for ( map { DBICTest->schema->class($_) } DBICTest->schema->sources ) {
|
65 | |
$_->class_resolver(undef);
|
66 | |
$_->resultset_instance(undef);
|
67 | |
$_->result_source_instance(undef);
|
68 | |
}
|
69 | |
{
|
70 | |
no warnings qw/redefine once/;
|
71 | |
*DBICTest::schema = sub {};
|
72 | |
}
|
73 | |
|
74 | 63 |
done_testing;
|
142 | 142 |
|
143 | 143 |
$SIG{INT} = sub { _cleanup_dbfile(); exit 1 };
|
144 | 144 |
|
|
145 |
my $need_global_cleanup;
|
145 | 146 |
sub _cleanup_dbfile {
|
146 | 147 |
# cleanup if this is us
|
147 | 148 |
if (
|
|
151 | 152 |
or
|
152 | 153 |
$ENV{DBICTEST_LOCK_HOLDER} == $$
|
153 | 154 |
) {
|
|
155 |
if ($need_global_cleanup and my $dbh = DBICTest->schema->storage->_dbh) {
|
|
156 |
$dbh->disconnect;
|
|
157 |
}
|
|
158 |
|
154 | 159 |
my $db_file = _sqlite_dbfilename();
|
155 | 160 |
unlink $_ for ($db_file, "${db_file}-journal");
|
156 | 161 |
}
|
|
315 | 320 |
my $schema;
|
316 | 321 |
|
317 | 322 |
if ($args{compose_connection}) {
|
|
323 |
$need_global_cleanup = 1;
|
318 | 324 |
$schema = DBICTest::Schema->compose_connection(
|
319 | 325 |
'DBICTest', $self->_database(%args)
|
320 | 326 |
);
|
127 | 127 |
],
|
128 | 128 |
'Expected SQL on correlated realiased subquery'
|
129 | 129 |
);
|
|
130 |
|
|
131 |
$schema->storage->disconnect;
|
130 | 132 |
|
131 | 133 |
# test for subselect identifier leakage
|
132 | 134 |
# NOTE - the hodge-podge mix of literal and regular identifuers is *deliberate*
|
145 | 145 |
);
|
146 | 146 |
}
|
147 | 147 |
|
|
148 |
$schema->storage->_dbh->disconnect;
|
|
149 |
|
148 | 150 |
# make sure connection-less storages do not throw on _determine_driver
|
149 | 151 |
# but work with ENV at the same time
|
150 | 152 |
SKIP: for my $env_dsn (undef, (DBICTest->_database)[0] ) {
|