Restore ability to handle underdefined root (t/prefetch/incomplete.t)
[dbsrgits/DBIx-Class.git] / t / zzzzzzz_sqlite_deadlock.t
index 7bb0fe0..6a38d2c 100644 (file)
@@ -2,19 +2,34 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
+
 use lib 't/lib';
+use DBICTest::RunMode;
 
-use File::Temp ();
+if ( DBICTest::RunMode->is_plain ) {
+  plan( skip_all => "Skipping test on plain module install" );
+}
+
+use Test::Exception;
 use DBICTest;
-use DBICTest::Schema;
+use File::Temp ();
 
 plan tests => 2;
-my $wait_for = 10;  # how many seconds to wait
+my $wait_for = 120;  # how many seconds to wait
+
+# don't lock anything - this is a tempfile anyway
+$ENV{DBICTEST_LOCK_HOLDER} = -1;
 
 for my $close (0,1) {
 
-  my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' );
+  my $tmp = File::Temp->new(
+    UNLINK => 1,
+    DIR => 't/var',
+    SUFFIX => '.db',
+    TEMPLATE => 'DBIxClass-XXXXXX',
+    EXLOCK => 0,  # important for BSD and derivatives
+  );
+
   my $tmp_fn = $tmp->filename;
   close $tmp if $close;
 
@@ -27,7 +42,7 @@ for my $close (0,1) {
 
   lives_ok (sub {
     my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn");
-    warn $tmp_fn;
+    $schema->storage->dbh_do(sub { $_[1]->do('PRAGMA synchronous = OFF') });
     DBICTest->deploy_schema ($schema);
     DBICTest->populate_schema ($schema);
   });