Commit | Line | Data |
d7b94f7a |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use Test::Exception; |
6 | use lib 't/lib'; |
7 | |
8 | use File::Temp (); |
9 | use DBICTest; |
10 | use DBICTest::Schema; |
11 | |
12 | plan tests => 2; |
13 | my $wait_for = 10; # how many seconds to wait |
14 | |
15 | for my $close (0,1) { |
16 | |
17 | my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' ); |
18 | my $tmp_fn = $tmp->filename; |
19 | close $tmp if $close; |
20 | |
21 | local $SIG{ALRM} = sub { die sprintf ( |
22 | "Timeout of %d seconds reached (tempfile still open: %s)", |
23 | $wait_for, $close ? 'No' : 'Yes' |
24 | )}; |
25 | |
26 | alarm $wait_for; |
27 | |
28 | lives_ok (sub { |
29 | my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); |
d7b94f7a |
30 | DBICTest->deploy_schema ($schema); |
31 | DBICTest->populate_schema ($schema); |
32 | }); |
33 | |
34 | alarm 0; |
35 | } |