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 | |
39c9c72d |
12 | if ( DBICTest::RunMode->is_plain ) { |
d096e13f |
13 | plan( skip_all => "Skipping test on plain module install" ); |
14 | } |
15 | |
d7b94f7a |
16 | plan tests => 2; |
39c9c72d |
17 | my $wait_for = 120; # how many seconds to wait |
d7b94f7a |
18 | |
19 | for my $close (0,1) { |
20 | |
f86589ef |
21 | my $tmp = File::Temp->new( |
22 | UNLINK => 1, |
23 | TMPDIR => 1, |
24 | SUFFIX => '.sqlite', |
25 | EXLOCK => 0, # important for BSD and derivatives |
26 | ); |
27 | |
d7b94f7a |
28 | my $tmp_fn = $tmp->filename; |
29 | close $tmp if $close; |
30 | |
31 | local $SIG{ALRM} = sub { die sprintf ( |
32 | "Timeout of %d seconds reached (tempfile still open: %s)", |
33 | $wait_for, $close ? 'No' : 'Yes' |
34 | )}; |
35 | |
36 | alarm $wait_for; |
37 | |
38 | lives_ok (sub { |
39 | my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); |
d7b94f7a |
40 | DBICTest->deploy_schema ($schema); |
f86589ef |
41 | #DBICTest->populate_schema ($schema); |
d7b94f7a |
42 | }); |
43 | |
44 | alarm 0; |
45 | } |