9e006ac4e2
Currently, our default branch in tests is "master". This is the Git default, but the Git default will likely change in the future, so it makes sense to update our testsuite to be explicit about the branch name. We'll ensure this continues by building against older versions of Git as well as newer versions. We use "main" for the new branch name, since that's the proposed value upstream. This commit was made entirely by automated means using the following command: git grep -l master t | xargs sed -i -e 's/master/main/g'
76 lines
2.2 KiB
Bash
Executable File
76 lines
2.2 KiB
Bash
Executable File
#!/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
|