1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/usr/bin/env bash
. "$(dirname "$0")/testlib.sh"
begin_test "tus-upload-uninterrupted"
(
set -e
# this repo name is the indicator to the server to use tus
reponame="test-tus-upload"
setup_remote_repo "$reponame"
clone_repo "$reponame" $reponame
git config lfs.tustransfers true
git lfs track "*.dat" 2>&1 | tee track.log
grep "Tracking \"\*.dat\"" track.log
contents="send-verify-action"
contents_oid=$(calc_oid "$contents")
printf "%s" "$contents" > a.dat
git add a.dat
git add .gitattributes
git commit -m "add a.dat" 2>&1 | tee commit.log
GIT_TRACE=1 GIT_TRANSFER_TRACE=1 git push origin main 2>&1 | tee pushtus.log
grep "xfer: tus.io uploading" pushtus.log
assert_server_object "$reponame" "$contents_oid"
)
end_test
begin_test "tus-upload-interrupted-resume"
(
set -e
# this repo name is the indicator to the server to use tus, AND to
# interrupt the upload part way
reponame="test-tus-upload-interrupt"
setup_remote_repo "$reponame"
clone_repo "$reponame" $reponame
git config lfs.tustransfers true
git lfs track "*.dat" 2>&1 | tee track.log
grep "Tracking \"\*.dat\"" track.log
contents_verify="send-verify-action"
contents_verify_oid="$(calc_oid "$contents_verify")"
# this string announces to server that we want it to abort the download part
# way, but reject the Range: header and fall back on re-downloading instead
contents="234587134187634598o634857619384765b747qcvtuedvoaicwtvseudtvcoqi7280r7qvow4i7r8c46pr9q6v9pri6ioq2r8"
contents_oid=$(calc_oid "$contents")
printf "%s" "$contents" > a.dat
printf "%s" "$contents_verify" > verify.dat
git add a.dat verify.dat
git add .gitattributes
git commit -m "add a.dat, verify.dat" 2>&1 | tee commit.log
GIT_TRACE=1 GIT_TRANSFER_TRACE=1 git push origin main 2>&1 | tee pushtus_resume.log
# first attempt will start from the beginning
grep "xfer: tus.io uploading" pushtus_resume.log
grep "HTTP: 500" pushtus_resume.log
# that will have failed but retry on 500 will resume it
grep "xfer: tus.io resuming" pushtus_resume.log
grep "HTTP: 204" pushtus_resume.log
# should have completed in the end
assert_server_object "$reponame" "$contents_oid"
assert_server_object "$reponame" "$contents_verify_oid"
)
end_test
|