3 . "$(dirname "$0")/testlib.sh"
5 # push_fail_test preforms a test expecting a `git lfs push` to fail given the
6 # contents of a particular file contained within that push. The Git server used
7 # during tests has certain special cases that are triggered by finding specific
8 # keywords within a file (as given by the first argument).
10 # An optional second argument can be included, "msg", that assert that the
11 # contents "msg" was included in the output of a `git lfs push`.
18 local reponame="$(basename "$0" ".sh")-$contents"
19 setup_remote_repo "$reponame"
20 clone_repo "$reponame" "$reponame"
23 printf "hi" > good.dat
24 printf "$contents" > bad.dat
25 git add .gitattributes good.dat bad.dat
29 git push origin master 2>&1 | tee push.log
30 res="${PIPESTATUS[0]}"
33 if [ ! -z "$msg" ]; then
37 refute_server_object "$reponame" "$(calc_oid "$contents")"
38 if [ "$res" = "0" ]; then
39 echo "push successful?"
44 begin_test "push: upload file with storage 403"
48 push_fail_test "status-storage-403"
52 begin_test "push: upload file with storage 404"
56 push_fail_test "status-storage-404"
60 begin_test "push: upload file with storage 410"
64 push_fail_test "status-storage-410"
68 begin_test "push: upload file with storage 500"
72 push_fail_test "status-storage-500"
76 begin_test "push: upload file with storage 503"
80 push_fail_test "status-storage-503" "LFS is temporarily unavailable"
84 begin_test "push: upload file with api 403"
88 push_fail_test "status-batch-403"
92 begin_test "push: upload file with api 404"
96 push_fail_test "status-batch-404"
100 begin_test "push: upload file with api 410"
104 push_fail_test "status-batch-410"
108 begin_test "push: upload file with api 422"
112 push_fail_test "status-batch-422"
116 begin_test "push: upload file with api 500"
120 push_fail_test "status-batch-500"