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