From: Dagfinn Ilmari Mannsåker Date: Sat, 1 Sep 2012 01:22:27 +0000 (+0100) Subject: Fix t/storage/reconnect.t when run as root X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=64819b0e69a844bb790701e13931afcc34f3d981;p=dbsrgits%2FDBIx-Class-Historic.git Fix t/storage/reconnect.t when run as root 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. --- diff --git a/Changes b/Changes index 2fef676..560b8ca 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ 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 diff --git a/t/storage/reconnect.t b/t/storage/reconnect.t index b28734b..17bd75f 100644 --- a/t/storage/reconnect.t +++ b/t/storage/reconnect.t @@ -54,8 +54,9 @@ chmod 0000, $db_orig; } '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: $!";