Update push test to use status code 200
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
3ddc3cfbe5
commit
f24de70161
|
@ -33,7 +33,8 @@ func TestPush(t *testing.T) {
|
||||||
lastPath string
|
lastPath string
|
||||||
)
|
)
|
||||||
|
|
||||||
// Fake a Pushgateway that always responds with 202.
|
// Fake a Pushgateway that responds with 202 to DELETE and with 200 in
|
||||||
|
// all other cases.
|
||||||
pgwOK := httptest.NewServer(
|
pgwOK := httptest.NewServer(
|
||||||
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
lastMethod = r.Method
|
lastMethod = r.Method
|
||||||
|
@ -44,7 +45,11 @@ func TestPush(t *testing.T) {
|
||||||
}
|
}
|
||||||
lastPath = r.URL.EscapedPath()
|
lastPath = r.URL.EscapedPath()
|
||||||
w.Header().Set("Content-Type", `text/plain; charset=utf-8`)
|
w.Header().Set("Content-Type", `text/plain; charset=utf-8`)
|
||||||
w.WriteHeader(http.StatusAccepted)
|
if r.Method == http.MethodDelete {
|
||||||
|
w.WriteHeader(http.StatusAccepted)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
defer pgwOK.Close()
|
defer pgwOK.Close()
|
||||||
|
|
Loading…
Reference in New Issue