Really fix SQLite savepoints unlike the shortsighted 398215b1
[dbsrgits/DBIx-Class.git] / t / storage / savepoints.t
index f99c9d5..b125d6e 100644 (file)
@@ -5,8 +5,8 @@ use warnings;
 
 use Test::More;
 use Test::Exception;
-use DBIx::Class::_Util qw(modver_gt_or_eq sigwarn_silencer scope_guard);
-
+use DBIx::Class::Optional::Dependencies;
+use DBIx::Class::_Util qw(sigwarn_silencer scope_guard);
 
 use DBICTest;
 
@@ -37,13 +37,10 @@ for ('', keys %$env2optdep) { SKIP: {
   my $prefix;
 
   if ($prefix = $_) {
-    my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/;
 
-    skip ("Skipping tests with $prefix: set \$ENV{${prefix}_DSN} _USER and _PASS", 1)
-      unless $dsn;
+    DBIx::Class::Optional::Dependencies->skip_without($env2optdep->{$prefix});
 
-    skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1)
-      unless  DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix});
+    my ($dsn, $user, $pass) = map { $ENV{"${prefix}_$_"} } qw/DSN USER PASS/;
 
     $schema = DBICTest::Schema->connect ($dsn,$user,$pass,{ auto_savepoint => 1 });
 
@@ -230,15 +227,6 @@ for ('', keys %$env2optdep) { SKIP: {
 
   is_deeply( $schema->storage->savepoints, [], 'All savepoints forgotten' );
 
-SKIP: {
-  skip "Reading inexplicably fails on very old replicated DBD::SQLite<1.33", 1 if (
-    $ENV{DBICTEST_VIA_REPLICATED}
-      and
-    $prefix eq 'SQLite Internal DB'
-      and
-    ! modver_gt_or_eq('DBD::SQLite', '1.33')
-  );
-
   ok($ars->search({ name => 'in_outer_transaction' })->first,
     'commit from outer transaction');
   ok($ars->search({ name => 'in_outer_transaction2' })->first,
@@ -248,7 +236,9 @@ SKIP: {
   is $ars->search({ name => 'in_inner_transaction_rolling_back' })->first,
     undef,
     'rollback from inner transaction';
-}
+
+  # make sure a fresh txn will work after above
+  $schema->storage->txn_do(sub { ok "noop" } );
 
 ### cleanupz
   $schema->storage->dbh_do(sub { $_[1]->do("DROP TABLE artist") });
@@ -257,8 +247,6 @@ SKIP: {
 done_testing;
 
 END {
-  local $SIG{__WARN__} = sigwarn_silencer( qr/Internal transaction state of handle/ )
-    unless modver_gt_or_eq('DBD::SQLite', '1.33');
   eval { $schema->storage->dbh_do(sub { $_[1]->do("DROP TABLE artist") }) } if defined $schema;
   undef $schema;
 }