Commit | Line | Data |
d7b94f7a |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
d7b94f7a |
5 | |
8d6b1478 |
6 | use lib 't/lib'; |
bedbc811 |
7 | BEGIN { |
8 | require DBICTest::RunMode; |
9 | plan( skip_all => "Skipping test on plain module install" ) |
10 | if DBICTest::RunMode->is_plain; |
d096e13f |
11 | } |
12 | |
8d6b1478 |
13 | use Test::Exception; |
14 | use DBICTest; |
2c2bc4e5 |
15 | use DBICTest::Schema; |
8d6b1478 |
16 | use File::Temp (); |
17 | |
d7b94f7a |
18 | plan tests => 2; |
39c9c72d |
19 | my $wait_for = 120; # how many seconds to wait |
d7b94f7a |
20 | |
8d6b1478 |
21 | # don't lock anything - this is a tempfile anyway |
22 | $ENV{DBICTEST_LOCK_HOLDER} = -1; |
23 | |
d7b94f7a |
24 | for my $close (0,1) { |
25 | |
f86589ef |
26 | my $tmp = File::Temp->new( |
27 | UNLINK => 1, |
8d6b1478 |
28 | DIR => 't/var', |
29 | SUFFIX => '.db', |
30 | TEMPLATE => 'DBIxClass-XXXXXX', |
f86589ef |
31 | EXLOCK => 0, # important for BSD and derivatives |
32 | ); |
33 | |
d7b94f7a |
34 | my $tmp_fn = $tmp->filename; |
35 | close $tmp if $close; |
36 | |
37 | local $SIG{ALRM} = sub { die sprintf ( |
38 | "Timeout of %d seconds reached (tempfile still open: %s)", |
39 | $wait_for, $close ? 'No' : 'Yes' |
40 | )}; |
41 | |
42 | alarm $wait_for; |
43 | |
44 | lives_ok (sub { |
45 | my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); |
8d6b1478 |
46 | $schema->storage->dbh_do(sub { $_[1]->do('PRAGMA synchronous = OFF') }); |
d7b94f7a |
47 | DBICTest->deploy_schema ($schema); |
8d6b1478 |
48 | DBICTest->populate_schema ($schema); |
d7b94f7a |
49 | }); |
50 | |
51 | alarm 0; |
52 | } |