scmstore: update more tests

Summary: Update more tests to avoid relying on pack files and legacy LFS, and override configs in `test-inconsistent-hash.t` to continue using pack files even after the scmstore rollout to test the Mononoke's response to corruption, which is not currently as easy with indexedlog.

Reviewed By: quark-zju

Differential Revision: D29229650

fbshipit-source-id: 11fe677fcecbb19acbefc9182b17062b8e1644d8
This commit is contained in:
Meyer Jacobs 2021-06-21 20:31:51 -07:00 committed by Facebook GitHub Bot
parent 1b4a0ae6b5
commit 88ab7198bc
4 changed files with 59 additions and 60 deletions

View File

@ -5,7 +5,6 @@
# directory of this source tree.
$ . "${TEST_FIXTURES}/library.sh"
$ setconfig remotefilelog.write-hgcache-to-indexedlog=False remotefilelog.write-local-to-indexedlog=False
setup configuration
$ setup_common_config
@ -54,15 +53,19 @@ Pull from Mononoke
warning: stream clone is disabled
Make sure that cache is empty
$ ls $TESTTMP/cachepath/repo/packs/manifests
$ hg debugdumpindexedlog $TESTTMP/cachepath/repo/manifests/indexedlogdatastore/0 |& grep Entry | wc -l
0
$ hg debugdumpindexedlog $TESTTMP/cachepath/repo/manifests/indexedloghistorystore/0 |& grep Entry | wc -l
0
$ hgmn prefetch -r "min(all())" -r1
$ hgmn prefetch -r 2
Make sure that new entries were downloaded
$ [[ -a $TESTTMP/cachepath/repo/packs/manifests ]]
$ ls $TESTTMP/cachepath/repo/packs/manifests | wc -l
8
$ hg debugdumpindexedlog $TESTTMP/cachepath/repo/manifests/indexedlogdatastore/0 |& grep Entry | wc -l
3
$ hg debugdumpindexedlog $TESTTMP/cachepath/repo/manifests/indexedloghistorystore/0 |& grep Entry | wc -l
3
Update to the revisions. Change the path to make sure that gettreepack command is
not sent because we've already downloaded all the trees

View File

@ -6,7 +6,10 @@
$ CACHEDIR=$PWD/cachepath
$ . "${TEST_FIXTURES}/library.sh"
# For now this test requires packfiles as there's no existing config option for disabling indexedlog integrity checks
# to force the client to try to push corrupted data
$ setconfig remotefilelog.write-hgcache-to-indexedlog=False remotefilelog.write-local-to-indexedlog=False
$ setconfig scmstore.enableshim=False
# setup config repo
@ -55,6 +58,9 @@
# change access to file, as it is readonly
$ chmod 666 "$PACK_TO_CORRUPT"
$ sed -i s/hello_world/aaaaaaaaaaa/ "$PACK_TO_CORRUPT"
# TODO(meyer): Corrupt indexedlog instead and disable integrity checks
# $ chmod 666 .hg/store/indexedlogdatastore/log
# $ sed -i s/hello_world/aaaaaaaaaaa/ .hg/store/indexedlogdatastore/log
Do a push, but disable cache verification on the client side, otherwise
filenode won't be send at all

View File

@ -103,6 +103,12 @@ Create a new client repository, using getpack (with its own cachepath).
> [remotefilelog]
> fetchpacks = True
> getpackversion = 2
> write-hgcache-to-indexedlog = True
> write-local-to-indexedlog = True
> indexedlogdatastore = True
> indexedloghistorystore = True
> lfs = True
> useruststore = True
> cachepath=$TESTTMP/cachepath-alt2
> EOF
@ -111,6 +117,4 @@ Create a new client repository, using getpack (with its own cachepath).
Now set wantslfspointers, make sure we download lfs pointers
$ hgmn update -r master_bookmark -v --config lfs.wantslfspointers=True
resolving manifests
lfs: downloading e2fff2ce58d585b4b0572e0a323f9e7e5f98cc641489e12c03c401d05d0e350d (1.95 KB)
lfs: processed: e2fff2ce58d585b4b0572e0a323f9e7e5f98cc641489e12c03c401d05d0e350d
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

View File

@ -1,7 +1,6 @@
#chg-compatible
$ CACHEDIR=`pwd`/hgcache
$ setconfig remotefilelog.write-hgcache-to-indexedlog=False remotefilelog.write-local-to-indexedlog=False
$ . "$TESTDIR/library.sh"
@ -57,12 +56,10 @@ Create client1 - it will have both server commits
$ echo b > dir/b
$ hg commit -Aqm 'initial commit'
$ ls .hg/store/packs/manifests
53e6d2d846d94f543bad25dcbaa1f753c3ce9fa6.histidx
53e6d2d846d94f543bad25dcbaa1f753c3ce9fa6.histpack
b7cac023ec87107fd7c501085ba31c96485d802d.dataidx
b7cac023ec87107fd7c501085ba31c96485d802d.datapack
$ hg debugdumpindexedlog .hg/store/manifests/indexedlogdatastore |& grep Entry | wc -l
2
$ hg debugdumpindexedlog .hg/store/manifests/indexedloghistorystore |& grep Entry | wc -l
2
$ clearcache
Pushing p2p with sendtrees=True puts the received packs in the local pack store
@ -86,36 +83,43 @@ Pushing p2p with sendtrees=True puts the received packs in the local pack store
2 trees fetched over 0.00s
fetching tree '' 90044db98b33ed191d9e056e2c2ec65ae7af8338, found via b8ff91c925b4
2 trees fetched over 0.00s
$ ls ../client2/.hg/store/packs/manifests
51e464ee849d281ededc123094852f7217b677b3.dataidx
51e464ee849d281ededc123094852f7217b677b3.datapack
8eb3321b2b6f800e1a8cc163471046748725a9bf.histidx
8eb3321b2b6f800e1a8cc163471046748725a9bf.histpack
$ hg log
commit: 54609f68e211
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: initial commit
commit: b8ff91c925b4
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: modify subdir/x again
commit: 2937cde31c19
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: modify subdir/x
commit: 2278cc8c6ce6
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add subdir/x
$ mv ../client2/.hg/hgrc.bak ../client2/.hg/hgrc
$ hg debughistorypack ../client2/.hg/store/packs/manifests/*histidx
Node P1 Node P2 Node Link Node Copy From
3ffa0e0bbc70 90044db98b33 000000000000 54609f68e211
90044db98b33 d9920715ba88 000000000000 b8ff91c925b4
d9920715ba88 85b359fdb09e 000000000000 2937cde31c19
dir
Node P1 Node P2 Node Link Node Copy From
23226e7a252c 000000000000 000000000000 54609f68e211
subdir
Node P1 Node P2 Node Link Node Copy From
143a95c22d77 a18d21674e76 000000000000 b8ff91c925b4
a18d21674e76 bc0c2c938b92 000000000000 2937cde31c19
$ hg debugdumpindexedlog ../client2/.hg/store/manifests/indexedlogdatastore |& grep Entry | wc -l
6
$ hg debugdumpindexedlog ../client2/.hg/store/manifests/indexedloghistorystore |& grep Entry | wc -l
6
Pulling between peers should send local trees but not remote trees
# Strip back one server commit and one draft commit, so we can pull them again
$ cd ../client2
$ hg debugstrip -r 'max(desc(modify))' --no-backup
# Delete the old local tree data from the draft commit, so we can verify it is
# downloaded again during pull.
$ rm -rf .hg/store/packs/*
$ rm -rf .hg/store/manifests
$ hg debugdumpindexedlog .hg/store/manifests/indexedlogdatastore |& grep Entry | wc -l
0
$ hg debugdumpindexedlog .hg/store/manifests/indexedloghistorystore |& grep Entry | wc -l
0
# Change this client to use a different cache from the other client, since the
# other client may populate data that we need to test if this client is
# downloading.
@ -130,29 +134,11 @@ Pulling between peers should send local trees but not remote trees
$ rm -rf $TESTTMP/hgcache2/*
$ hg pull -q --config treemanifest.sendtrees=True ../client1 --config remotefilelog.fallbackpath=ssh://user@dummy/master
# Check that the local commits for the draft commit were downloaded to the local store.
$ ls_l .hg/store/packs/manifests
-r--r--r-- 1194 584f14ba73a87b958e438135ea033ac7fdbb2cf0.dataidx
-r--r--r-- 523 584f14ba73a87b958e438135ea033ac7fdbb2cf0.datapack
-r--r--r-- 1301 cc1beef66dec330fd4cf9dcf56707c8f57031a78.histidx
-r--r--r-- 356 cc1beef66dec330fd4cf9dcf56707c8f57031a78.histpack
$ hg debugdatapack .hg/store/packs/manifests/*.datapack
.hg/store/packs/manifests/584f14ba73a87b958e438135ea033ac7fdbb2cf0:
subdir:
Node Delta Base Delta Length Blob Size
143a95c22d77 000000000000 43 (missing)
(empty name):
Node Delta Base Delta Length Blob Size
90044db98b33 000000000000 49 (missing)
dir:
Node Delta Base Delta Length Blob Size
23226e7a252c 000000000000 43 (missing)
(empty name):
Node Delta Base Delta Length Blob Size
3ffa0e0bbc70 000000000000 138 (missing)
$ hg debugdumpindexedlog .hg/store/manifests/indexedlogdatastore |& grep Entry | wc -l
4
$ hg debugdumpindexedlog .hg/store/manifests/indexedloghistorystore |& grep Entry | wc -l
4
# Verify the real-public commit wasn't received during the pull and therefore
# has to be downloaded on demand.
$ rm -rf $TESTTMP/hgcache2/*