Skip to content

Commit f24de70

Browse files
committed
Update push test to use status code 200
Signed-off-by: beorn7 <[email protected]>
1 parent 3ddc3cf commit f24de70

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

prometheus/push/push_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func TestPush(t *testing.T) {
3333
lastPath string
3434
)
3535

36-
// Fake a Pushgateway that always responds with 202.
36+
// Fake a Pushgateway that responds with 202 to DELETE and with 200 in
37+
// all other cases.
3738
pgwOK := httptest.NewServer(
3839
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
3940
lastMethod = r.Method
@@ -44,7 +45,11 @@ func TestPush(t *testing.T) {
4445
}
4546
lastPath = r.URL.EscapedPath()
4647
w.Header().Set("Content-Type", `text/plain; charset=utf-8`)
47-
w.WriteHeader(http.StatusAccepted)
48+
if r.Method == http.MethodDelete {
49+
w.WriteHeader(http.StatusAccepted)
50+
return
51+
}
52+
w.WriteHeader(http.StatusOK)
4853
}),
4954
)
5055
defer pgwOK.Close()

0 commit comments

Comments
 (0)