2016-10-15 22:15:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "batch storage upload causes retries"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="batch-storage-upload-retry"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" batch-storage-repo-upload
|
|
|
|
|
|
|
|
contents="storage-upload-retry"
|
|
|
|
oid="$(calc_oid "$contents")"
|
|
|
|
printf "$contents" > a.dat
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
git add .gitattributes a.dat
|
|
|
|
git commit -m "initial commit"
|
|
|
|
|
|
|
|
git config --local lfs.transfer.maxretries 3
|
2017-04-26 17:22:51 +00:00
|
|
|
|
|
|
|
GIT_TRACE=1 git push origin master 2>&1 | tee push.log
|
|
|
|
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
|
|
|
|
echo >&2 "fatal: expected \`git push origin master\` to succeed ..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
actual_count="$(grep -c "tq: retrying object $oid: Fatal error: Server error" push.log)"
|
|
|
|
[ "2" = "$actual_count" ]
|
2016-10-15 22:15:45 +00:00
|
|
|
|
|
|
|
assert_server_object "$reponame" "$oid"
|
|
|
|
)
|
|
|
|
end_test
|
2016-10-15 22:17:45 +00:00
|
|
|
|
|
|
|
begin_test "batch storage download causes retries"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="batch-storage-download-retry"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" batch-storage-repo-download
|
|
|
|
|
|
|
|
contents="storage-download-retry"
|
|
|
|
oid="$(calc_oid "$contents")"
|
|
|
|
printf "$contents" > a.dat
|
|
|
|
|
|
|
|
git lfs track "*.dat"
|
|
|
|
git add .gitattributes a.dat
|
|
|
|
git commit -m "initial commit"
|
|
|
|
|
|
|
|
git push origin master
|
|
|
|
assert_server_object "$reponame" "$oid"
|
|
|
|
|
|
|
|
pushd ..
|
|
|
|
git \
|
2016-10-24 06:13:49 +00:00
|
|
|
-c "filter.lfs.process=" \
|
2016-10-15 22:17:45 +00:00
|
|
|
-c "filter.lfs.smudge=cat" \
|
|
|
|
-c "filter.lfs.required=false" \
|
|
|
|
clone "$GITSERVER/$reponame" "$reponame-assert"
|
|
|
|
|
|
|
|
cd "$reponame-assert"
|
|
|
|
|
|
|
|
git config credential.helper lfstest
|
|
|
|
git config --local lfs.transfer.maxretries 3
|
|
|
|
|
2017-04-26 17:22:51 +00:00
|
|
|
GIT_TRACE=1 git lfs pull origin master 2>&1 | tee pull.log
|
|
|
|
if [ "0" -ne "${PIPESTATUS[0]}" ]; then
|
|
|
|
echo >&2 "fatal: expected \`git lfs pull origin master\` to succeed ..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
actual_count="$(grep -c "tq: retrying object $oid: Fatal error: Server error" pull.log)"
|
|
|
|
[ "2" = "$actual_count" ]
|
2016-10-15 22:17:45 +00:00
|
|
|
|
|
|
|
assert_local_object "$oid" "${#contents}"
|
|
|
|
popd
|
|
|
|
)
|
|
|
|
end_test
|