don't move keys db out from under sqlite

Instead remove enough data from it that this regression test tests what
it needs to.

Moving the database was the last thing that made the test suite
unstable, including sometimes hanging completely. It seems that, despite
closeDb being called before the move, sqlite was not quite done with it,
and somehow this causes other sqlite handles to become unstable. Not
good.

With this change, the test suite has successfully run 100+ times without
any issues.
This commit is contained in:
Joey Hess 2018-10-31 08:04:16 -04:00
parent 1c71f563e0
commit 89ac32616f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -650,9 +650,10 @@ test_lock_v7_force = intmpclonerepoInDirect $ do
git_annex "get" [annexedfile] @? "get of file failed"
git_annex "unlock" [annexedfile] @? "unlock failed in v7 mode"
annexeval $ do
Just k <- Annex.WorkTree.lookupFile annexedfile
Database.Keys.removeInodeCaches k
Database.Keys.closeDb
dbdir <- Annex.fromRepo Annex.Locations.gitAnnexKeysDb
liftIO $ renameDirectory dbdir (dbdir ++ ".old")
liftIO . nukeFile =<< Annex.fromRepo Annex.Locations.gitAnnexKeysDbIndexCache
writecontent annexedfile "test_lock_v7_force content"
git_annex_shouldfail "lock" [annexedfile] @? "lock of modified file failed to fail in v7 mode"
git_annex "lock" ["--force", annexedfile] @? "lock --force of modified file failed in v7 mode"