add a test case that move respects numcopies

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.
This commit is contained in:
Joey Hess 2020-11-13 13:49:12 -04:00
parent 57bd0cf4e3
commit 98d1cbd1ee
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

15
Test.hs
View file

@ -312,6 +312,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
, testCase "get (ssh remote)" test_get_ssh_remote , testCase "get (ssh remote)" test_get_ssh_remote
, testCase "move" test_move , testCase "move" test_move
, testCase "move (ssh remote)" test_move_ssh_remote , testCase "move (ssh remote)" test_move_ssh_remote
, testCase "move (numcopies)" test_move_numcopies
, testCase "copy" test_copy , testCase "copy" test_copy
, testCase "lock" test_lock , testCase "lock" test_lock
, testCase "lock --force" test_lock_force , testCase "lock --force" test_lock_force
@ -657,6 +658,20 @@ test_move' setup = setup $ do
unannexed ingitfile unannexed ingitfile
inmainrepo $ 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 :: Assertion
test_copy = intmpclonerepo $ do test_copy = intmpclonerepo $ do
annexed_notpresent annexedfile annexed_notpresent annexedfile