test: Improve pull corruption test

To verify pull with a second repo works.
This commit is contained in:
Jeremy Whiting 2013-08-27 16:01:43 -06:00 committed by Colin Walters
parent bb8418ff01
commit 902848cd71

View File

@ -35,10 +35,15 @@ do_corrupt_pull_test() {
${CMD_PREFIX} ostree --repo=repo init
${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo
if ${CMD_PREFIX} ostree --repo=repo pull origin main; then
assert_not_reached "pull unexpectedly succeeded!"
assert_not_reached "pull unexpectedly succeeded!"
fi
rm -rf ${repopath}
cp -a ${repopath}.orig ${repopath}
if ${CMD_PREFIX} ostree --repo=repo pull origin main && ${CMD_PREFIX} ostree --repo=repo fsck; then
echo "ok pull with correct data worked"
else
assert_not_reached "pull with correct data failed!"
fi
}
# Corrupt .dirmeta
@ -55,6 +60,7 @@ echo "ok corrupt dirtree"
# Corrupt .filez
someobject=$(find ${repopath} -name '*.filez' | head -1)
echo "garbage garbage garbage" > ${someobject}
otherobject=$(find ${repopath} -name '*.filez' | head -2 | tail -1)
cp ${someobject} ${otherobject}
do_corrupt_pull_test
echo "ok corrupt filez"