]> dgit.raspbian.org Git - git-annex.git/commitdiff
add a test case that move respects numcopies
authorJoey Hess <joeyh@joeyh.name>
Fri, 13 Nov 2020 17:49:12 +0000 (13:49 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 13 Nov 2020 18:06:57 +0000 (14:06 -0400)
There is already one for drop, but move and drop don't handle numcopies
exactly the same, and there was recently a reversion in it checking
numcopies properly at all.

This commit was sponsored by Noam Kremen on Patreon.

Test.hs

diff --git a/Test.hs b/Test.hs
index b67dff8398cb5e229153babc9ec3d4980ddbeed3..91083d4d648c7965543ab1a9967c42df735b5d63 100644 (file)
--- a/Test.hs
+++ b/Test.hs
@@ -312,6 +312,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
        , testCase "get (ssh remote)" test_get_ssh_remote
        , testCase "move" test_move
        , testCase "move (ssh remote)" test_move_ssh_remote
+       , testCase "move (numcopies)" test_move_numcopies
        , testCase "copy" test_copy
        , testCase "lock" test_lock
        , testCase "lock --force" test_lock_force
@@ -657,6 +658,20 @@ test_move' setup = setup $ do
        unannexed ingitfile
        inmainrepo $ unannexed ingitfile
 
+test_move_numcopies :: Assertion
+test_move_numcopies = intmpclonerepo $ do
+       inmainrepo $ annexed_present annexedfile
+       git_annex "numcopies" ["2"] @? "setting numcopies failed"
+       git_annex "move" ["--from", "origin", annexedfile] @? "move of file --from remote with numcopies unsatisfied but not made worse failed unexpectedly"
+       annexed_present annexedfile
+       inmainrepo $ annexed_notpresent annexedfile
+       git_annex "move" ["--to", "origin", annexedfile] @? "move of file --to remote with numcopies unsatisfied but not made worse failed unexpectedly"
+       annexed_notpresent annexedfile
+       inmainrepo $ annexed_present annexedfile
+       git_annex "get" [annexedfile] @? "get of file failed"
+       git_annex_shouldfail "move" ["--from", "origin", annexedfile] @? "move of file --from remote violated numcopies setting"
+       git_annex_shouldfail "move" ["--to", "origin", annexedfile] @? "move of file --to remote violated numcopies setting"
+
 test_copy :: Assertion
 test_copy = intmpclonerepo $ do
        annexed_notpresent annexedfile