##// END OF EJS Templates
test-lfs: add tests around corrupted lfs objects...
Matt Harbison -
r35490:16660fd4 default
parent child Browse files
Show More
@@ -105,6 +105,55 b' Clear the cache to force a download'
105 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
105 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
106 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
107
107
108 Test a corrupt file download, but clear the cache first to force a download
109
110 XXX: ideally, the validation would occur before polluting the usercache and
111 local store, with a clearer error message.
112
113 $ rm -rf `hg config lfs.usercache`
114 $ cp $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 blob
115 $ echo 'damage' > $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
116 $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
117 $ rm ../repo1/*
118 $ hg --repo ../repo1 update -C tip -v
119 resolving manifests
120 getting a
121 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
122 getting b
123 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
124 getting c
125 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
126 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
127 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
128 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
129 abort: integrity check failed on data/c.i:0!
130 [255]
131
132 BUG: the corrupted blob was added to the usercache and local store
133
134 $ cat ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 | $TESTDIR/f --sha256
135 sha256=fa82ca222fc9813afad3559637960bf311170cdd80ed35287f4623eb2320a660
136 $ cat `hg config lfs.usercache`/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 | $TESTDIR/f --sha256
137 sha256=fa82ca222fc9813afad3559637960bf311170cdd80ed35287f4623eb2320a660
138 $ cp blob $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
139
140 Test a corrupted file upload
141
142 $ echo 'another lfs blob' > b
143 $ hg ci -m 'another blob'
144 $ echo 'damage' > .hg/store/lfs/objects/e6/59058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
145 $ hg push -v ../repo1
146 pushing to ../repo1
147 searching for changes
148 lfs: uploading e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0 (17 bytes)
149 lfs: failed: LfsRemoteError('HTTP error: HTTP Error 500: Internal Server Error (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)',) (remaining retry 5)
150 lfs: failed: LfsRemoteError('HTTP error: HTTP Error 404: Not Found (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)',) (remaining retry 4)
151 lfs: failed: LfsRemoteError('HTTP error: HTTP Error 404: Not Found (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)',) (remaining retry 3)
152 lfs: failed: LfsRemoteError('HTTP error: HTTP Error 404: Not Found (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)',) (remaining retry 2)
153 lfs: failed: LfsRemoteError('HTTP error: HTTP Error 404: Not Found (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)',) (remaining retry 1)
154 abort: HTTP error: HTTP Error 404: Not Found (oid=e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0, action=upload)!
155 [255]
156
108 Check error message when the remote missed a blob:
157 Check error message when the remote missed a blob:
109
158
110 $ echo FFFFF > b
159 $ echo FFFFF > b
@@ -605,6 +605,193 b' remote store.'
605 added 3 changesets with 2 changes to 1 files
605 added 3 changesets with 2 changes to 1 files
606 $ hg -R repo14 -q verify
606 $ hg -R repo14 -q verify
607
607
608 Test damaged file scenarios. (This also damages the usercache because of the
609 hardlinks.)
610
611 $ echo 'damage' >> repo5/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
612
613 Repo with damaged lfs objects in any revision will fail verification.
614
615 $ hg -R repo5 verify
616 checking changesets
617 checking manifests
618 crosschecking files in changesets and manifests
619 checking files
620 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
621 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
622 4 files, 5 changesets, 10 total revisions
623 2 integrity errors encountered!
624 (first damaged changeset appears to be 0)
625 [1]
626
627 Updates work after cloning a damaged repo, if the damaged lfs objects aren't in
628 the update destination. Those objects won't be added to the new repo's store
629 because they aren't accessed.
630
631 $ hg clone -v repo5 fromcorrupt
632 updating to branch default
633 resolving manifests
634 getting l
635 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the usercache
636 getting s
637 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
638 $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
639 [1]
640
641 Verify will copy/link all lfs objects into the local store that aren't already
642 present. Bypass the corrupted usercache to show that verify works when fed by
643 the (uncorrupted) remote store.
644
645 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
646 repository uses revlog format 1
647 checking changesets
648 checking manifests
649 crosschecking files in changesets and manifests
650 checking files
651 lfs: adding 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e to the usercache
652 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
653 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
654 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
655 lfs: adding 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 to the usercache
656 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
657 lfs: adding b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c to the usercache
658 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
659 4 files, 5 changesets, 10 total revisions
660
661 BUG: Verify will copy/link a corrupted file from the usercache into the local
662 store, and poison it. (The verify with a good remote now fails.)
663
664 $ rm -r fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
665 $ hg -R fromcorrupt verify -v
666 repository uses revlog format 1
667 checking changesets
668 checking manifests
669 crosschecking files in changesets and manifests
670 checking files
671 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the usercache
672 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
673 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
674 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
675 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
676 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
677 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
678 4 files, 5 changesets, 10 total revisions
679 2 integrity errors encountered!
680 (first damaged changeset appears to be 0)
681 [1]
682 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v
683 repository uses revlog format 1
684 checking changesets
685 checking manifests
686 crosschecking files in changesets and manifests
687 checking files
688 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
689 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
690 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
691 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
692 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
693 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
694 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
695 4 files, 5 changesets, 10 total revisions
696 2 integrity errors encountered!
697 (first damaged changeset appears to be 0)
698 [1]
699
700 Damaging a file required by the update destination fails the update.
701
702 $ echo 'damage' >> $TESTTMP/dummy-remote/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
703 $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2
704 updating to branch default
705 resolving manifests
706 getting l
707 lfs: adding 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b to the usercache
708 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
709 abort: integrity check failed on data/l.i:3!
710 [255]
711
712 BUG: A corrupted lfs blob either shouldn't be created after a transfer from a
713 file://remotestore, or it shouldn't be left behind.
714
715 $ cat emptycache/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
716 sha256=40f67c7e91d554db4bc500f8f62c2e40f9f61daa5b62388e577bbae26f5396ff
717 $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
718 sha256=40f67c7e91d554db4bc500f8f62c2e40f9f61daa5b62388e577bbae26f5396ff
719
720 $ hg -R fromcorrupt2 verify
721 checking changesets
722 checking manifests
723 crosschecking files in changesets and manifests
724 checking files
725 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
726 l@4: unpacking 6f1ff1f39c11: integrity check failed on data/l.i:3
727 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
728 4 files, 5 changesets, 10 total revisions
729 3 integrity errors encountered!
730 (first damaged changeset appears to be 0)
731 [1]
732
733 BUG: push will happily send corrupt files upstream. (The alternate dummy remote
734 avoids the corrupt lfs object in the original remote.)
735
736 $ mkdir $TESTTMP/dummy-remote2
737 $ hg init dest
738 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 push -v dest
739 pushing to dest
740 searching for changes
741 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
742 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
743 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
744 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
745 5 changesets found
746 uncompressed size of bundle content:
747 997 (changelog)
748 1032 (manifests)
749 841 l
750 272 large
751 788 s
752 139 small
753 adding changesets
754 adding manifests
755 adding file changes
756 added 5 changesets with 10 changes to 4 files
757
758 $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 verify -v
759 repository uses revlog format 1
760 checking changesets
761 checking manifests
762 crosschecking files in changesets and manifests
763 checking files
764 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
765 l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0
766 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
767 l@4: unpacking 6f1ff1f39c11: integrity check failed on data/l.i:3
768 lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store
769 large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0
770 lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store
771 lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store
772 4 files, 5 changesets, 10 total revisions
773 3 integrity errors encountered!
774 (first damaged changeset appears to be 0)
775 [1]
776
777 $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
778 sha256=40f67c7e91d554db4bc500f8f62c2e40f9f61daa5b62388e577bbae26f5396ff
779 $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256
780 sha256=40f67c7e91d554db4bc500f8f62c2e40f9f61daa5b62388e577bbae26f5396ff
781
782 $ cat $TESTTMP/dummy-remote2/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
783 LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
784 damage
785 $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b
786 RESTORE-TO-BE-LARGE
787 damage
788
789 Accessing a corrupt file will complain
790
791 $ hg --cwd fromcorrupt2 cat -r 0 large
792 abort: integrity check failed on data/large.i:0!
793 [255]
794
608 lfs -> normal -> lfs round trip conversions are possible. The threshold for the
795 lfs -> normal -> lfs round trip conversions are possible. The threshold for the
609 lfs destination is specified here because it was originally listed in the local
796 lfs destination is specified here because it was originally listed in the local
610 .hgrc, and the global one is too high to trigger lfs usage. For lfs -> normal,
797 .hgrc, and the global one is too high to trigger lfs usage. For lfs -> normal,
General Comments 0
You need to be logged in to leave comments. Login now