Skip to content

Commit 7ccc6b5

Browse files
committed
test/push: assert message is logged in a /storage 503
1 parent 50ba7eb commit 7ccc6b5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

test/cmd/lfstest-gitserver.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
//
4848
contentHandlers = []string{
4949
"status-batch-403", "status-batch-404", "status-batch-410", "status-batch-422", "status-batch-500",
50-
"status-storage-403", "status-storage-404", "status-storage-410", "status-storage-422", "status-storage-500",
50+
"status-storage-403", "status-storage-404", "status-storage-410", "status-storage-422", "status-storage-500", "status-storage-503",
5151
"status-legacy-404", "status-legacy-410", "status-legacy-422", "status-legacy-403", "status-legacy-500",
5252
"status-batch-resume-206", "batch-resume-fail-fallback", "return-expired-action", "return-invalid-size",
5353
"object-authenticated",
@@ -489,6 +489,15 @@ func storageHandler(w http.ResponseWriter, r *http.Request) {
489489
return
490490
case "status-storage-500":
491491
w.WriteHeader(500)
492+
return
493+
case "status-storage-503":
494+
w.Header().Set("Content-Type", "application/vnd.git-lfs+json")
495+
w.WriteHeader(503)
496+
497+
json.NewEncoder(w).Encode(&struct {
498+
Message string `json:"message"`
499+
}{"LFS is temporarily unavailable"})
500+
492501
return
493502
case "object-authenticated":
494503
if len(r.Header.Get("Authorization")) > 0 {

test/test-push-failures.sh

+8
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ begin_test "push: upload file with storage 500"
8181
)
8282
end_test
8383

84+
begin_test "push: upload file with storage 503"
85+
(
86+
set -e
87+
88+
push_fail_test "status-storage-503" "LFS is temporarily unavailable"
89+
)
90+
end_test
91+
8492
begin_test "push: upload file with api 403"
8593
(
8694
set -e

0 commit comments

Comments
 (0)