summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:11:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:11:32 -0400
commitb557a2ccf4cd634a2c276b9ae03b881814de58be (patch)
tree5a1eed66d0183cc81e65358e9a6d0d14c5a33582
parentb13039d62eb3a99606562f2edca7405b96776787 (diff)
test migrate; 75%
-rw-r--r--debian/changelog2
-rw-r--r--test.hs30
2 files changed, 31 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 74fa4894a..6950bda20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,7 @@ git-annex (0.18) UNRELEASED; urgency=low
after transferring the file to the remote repository.
(Did not affect ssh remotes.)
* fsck: Fix bug in moving of corrupted files to .git/annex/bad/
- * Test suite improvements. Current top-level test coverage: 72%
+ * Test suite improvements. Current top-level test coverage: 75%
-- Joey Hess <joeyh@debian.org> Tue, 11 Jan 2011 16:05:25 -0400
diff --git a/test.hs b/test.hs
index 28209d099..716d1a0de 100644
--- a/test.hs
+++ b/test.hs
@@ -73,6 +73,7 @@ toplevels = TestLabel "toplevel" $ TestList
, test_fix
, test_trust
, test_fsck
+ , test_migrate
]
test_init :: Test
@@ -313,6 +314,35 @@ test_fsck = "git-annex fsck" ~: intmpclonerepo $ do
not r @? "fsck failed to fail with corrupted file content"
git_annex "fsck" ["-q"] @? "fsck unexpectedly failed again; previous one did not fix problem"
+test_migrate :: Test
+test_migrate = "git-annex migrate" ~: TestList [t False, t True]
+ where t usegitattributes = TestCase $ intmpclonerepo $ do
+ annexed_notpresent annexedfile
+ annexed_notpresent sha1annexedfile
+ git_annex "migrate" ["-q", annexedfile] @? "migrate of not present failed"
+ git_annex "migrate" ["-q", sha1annexedfile] @? "migrate of not present failed"
+ git_annex "get" ["-q", annexedfile] @? "get of file failed"
+ git_annex "get" ["-q", sha1annexedfile] @? "get of file failed"
+ annexed_present annexedfile
+ annexed_present sha1annexedfile
+ if usegitattributes
+ then do
+ writeFile ".gitattributes" "* annex.backend=SHA1"
+ git_annex "migrate" [sha1annexedfile] @? "migrate to same backend failed"
+ git_annex "migrate" [annexedfile] @? "migrate to different backend failed"
+ else do
+ git_annex "migrate" [sha1annexedfile, "--backend=SHA1"] @? "migrate to same backend failed"
+ git_annex "migrate" [annexedfile, "--backend=SHA1"] @? "migrate to different backend failed"
+ annexed_present annexedfile
+ annexed_present sha1annexedfile
+ backend annexedfile Backend.SHA1.backend
+ backend sha1annexedfile Backend.SHA1.backend
+ where
+ backend file expected = do
+ r <- annexeval $ Backend.lookupFile file
+ let b = snd $ fromJust r
+ assertEqual ("backend for " ++ file) expected b
+
-- This is equivilant to running git-annex, but it's all run in-process
-- so test coverage collection works.
git_annex :: String -> [String] -> IO Bool