add test case for readonly remote
Tests for the reversion fixed in 837116ef1e
and similar problems.
Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
249d424b8a
commit
ccf7e5b949
2 changed files with 28 additions and 8 deletions
27
Test.hs
27
Test.hs
|
@ -75,6 +75,7 @@ import qualified BuildInfo
|
||||||
import qualified Utility.Format
|
import qualified Utility.Format
|
||||||
import qualified Utility.Verifiable
|
import qualified Utility.Verifiable
|
||||||
import qualified Utility.Process
|
import qualified Utility.Process
|
||||||
|
import qualified Utility.Process.Transcript
|
||||||
import qualified Utility.Misc
|
import qualified Utility.Misc
|
||||||
import qualified Utility.InodeCache
|
import qualified Utility.InodeCache
|
||||||
import qualified Utility.Env
|
import qualified Utility.Env
|
||||||
|
@ -309,6 +310,7 @@ unitTests :: String -> TestTree
|
||||||
unitTests note = testGroup ("Unit Tests " ++ note)
|
unitTests note = testGroup ("Unit Tests " ++ note)
|
||||||
[ testCase "add dup" test_add_dup
|
[ testCase "add dup" test_add_dup
|
||||||
, testCase "add extras" test_add_extras
|
, testCase "add extras" test_add_extras
|
||||||
|
, testCase "readonly" test_readonly
|
||||||
, testCase "ignore deleted files" test_ignore_deleted_files
|
, testCase "ignore deleted files" test_ignore_deleted_files
|
||||||
, testCase "metadata" test_metadata
|
, testCase "metadata" test_metadata
|
||||||
, testCase "export_import" test_export_import
|
, testCase "export_import" test_export_import
|
||||||
|
@ -427,6 +429,23 @@ test_add_extras = intmpclonerepo $ do
|
||||||
annexed_present wormannexedfile
|
annexed_present wormannexedfile
|
||||||
checkbackend wormannexedfile backendWORM
|
checkbackend wormannexedfile backendWORM
|
||||||
|
|
||||||
|
test_readonly :: Assertion
|
||||||
|
test_readonly =
|
||||||
|
withtmpclonerepo $ \r1 ->
|
||||||
|
withtmpclonerepo $ \r2 -> do
|
||||||
|
pair r1 r2
|
||||||
|
indir r1 $ do
|
||||||
|
git_annex "get" [annexedfile] "get failed in first repo"
|
||||||
|
{- chmod may fail, or not be available, or the
|
||||||
|
- filesystem not support permissions. -}
|
||||||
|
void $ Utility.Process.Transcript.processTranscript
|
||||||
|
"chmod" ["-R", "-w", r1] Nothing
|
||||||
|
indir r2 $ do
|
||||||
|
git_annex "sync" ["r1", "--no-push"] "sync with readonly repo"
|
||||||
|
git_annex "get" [annexedfile, "--from", "r1"] "get from readonly repo"
|
||||||
|
git "remote" ["rm", "origin"] "remote rm"
|
||||||
|
git_annex "drop" [annexedfile] "drop vs readonly repo"
|
||||||
|
|
||||||
test_ignore_deleted_files :: Assertion
|
test_ignore_deleted_files :: Assertion
|
||||||
test_ignore_deleted_files = intmpclonerepo $ do
|
test_ignore_deleted_files = intmpclonerepo $ do
|
||||||
git_annex "get" [annexedfile] "get"
|
git_annex "get" [annexedfile] "get"
|
||||||
|
@ -1640,14 +1659,6 @@ test_adjusted_branch_subtree_regression =
|
||||||
git "checkout" [origbranch] "git checkout"
|
git "checkout" [origbranch] "git checkout"
|
||||||
doesFileExist "a/b/x/y" @? ("a/b/x/y missing from master after adjusted branch sync")
|
doesFileExist "a/b/x/y" @? ("a/b/x/y missing from master after adjusted branch sync")
|
||||||
|
|
||||||
{- Set up repos as remotes of each other. -}
|
|
||||||
pair :: FilePath -> FilePath -> Assertion
|
|
||||||
pair r1 r2 = forM_ [r1, r2] $ \r -> indir r $ do
|
|
||||||
when (r /= r1) $
|
|
||||||
git "remote" ["add", "r1", "../../" ++ r1] "remote add"
|
|
||||||
when (r /= r2) $
|
|
||||||
git "remote" ["add", "r2", "../../" ++ r2] "remote add"
|
|
||||||
|
|
||||||
test_map :: Assertion
|
test_map :: Assertion
|
||||||
test_map = intmpclonerepo $ do
|
test_map = intmpclonerepo $ do
|
||||||
-- set descriptions, that will be looked for in the map
|
-- set descriptions, that will be looked for in the map
|
||||||
|
|
|
@ -631,3 +631,12 @@ origBranch :: Types.Annex String
|
||||||
origBranch = maybe "foo"
|
origBranch = maybe "foo"
|
||||||
(Git.Types.fromRef . Git.Ref.base . Annex.AdjustedBranch.fromAdjustedBranch)
|
(Git.Types.fromRef . Git.Ref.base . Annex.AdjustedBranch.fromAdjustedBranch)
|
||||||
<$> Annex.inRepo Git.Branch.current
|
<$> Annex.inRepo Git.Branch.current
|
||||||
|
|
||||||
|
{- Set up repos as remotes of each other. -}
|
||||||
|
pair :: FilePath -> FilePath -> Assertion
|
||||||
|
pair r1 r2 = forM_ [r1, r2] $ \r -> indir r $ do
|
||||||
|
when (r /= r1) $
|
||||||
|
git "remote" ["add", "r1", "../../" ++ r1] "remote add"
|
||||||
|
when (r /= r2) $
|
||||||
|
git "remote" ["add", "r2", "../../" ++ r2] "remote add"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue