As root, the chmod 000 doesn't prevent SQLite form opening the fake db
file, so we need to disconnect to make it reopen the restored real one.
Revision history for DBIx::Class
+ * Fixes
+ - Fix t/storage/reconnect.t when run as root
+
0.08200 2012-08-24 (UTC)
* Fixes
- Change one of the new tests for the previous release to not require
} 'The operation failed';
}
-# otherwise can't unlink the fake db file
-$schema->storage->_dbh->disconnect if $^O eq 'MSWin32';
+# otherwise win32 can't unlink the fake db file
+# as root sqlite will have the file open and won't reconnect
+$schema->storage->_dbh->disconnect if $^O eq 'MSWin32' or $> == 0;
### Now, move the db file back to the correct name
unlink($db_orig) or die "could not delete $db_orig: $!";