1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-16 04:44:55 +02:00

internal/api/eosio_v1_test.go: Assert any errors from http.ResponseWriter.Write()

This commit is contained in:
Henrik Hautakoski 2022-11-24 14:50:53 +01:00
parent c48162742f
commit bcd9a93a35
No known key found for this signature in database
GPG key ID: 608414D93E862CCD

View file

@ -46,7 +46,8 @@ func TestEosioV1SetTime(t *testing.T) {
func TestEosioV1JsonFailure(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
res.Write([]byte(`!//{invalid-json}!##`))
_, err := res.Write([]byte(`!//{invalid-json}!##`))
assert.NoError(t, err)
}))
api := NewEosioV1(srv.URL, "", 120)
@ -59,7 +60,8 @@ func TestEosioV1JsonFailure(t *testing.T) {
func TestEosioV1HTTP500Failed(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
res.WriteHeader(500)
res.Write([]byte(`{}`))
_, err := res.Write([]byte(`{}`))
assert.NoError(t, err)
}))
api := NewEosioV1(srv.URL, "", 120)
@ -80,7 +82,8 @@ func TestEosioV1LaggingUp(t *testing.T) {
"head_block_time": "2022-02-24T13:37:00"
}`
res.Write([]byte(info))
_, err := res.Write([]byte(info))
assert.NoError(t, err)
}
}))
@ -103,7 +106,8 @@ func TestEosioV1LaggingDown(t *testing.T) {
"head_block_time": "2018-01-01T13:37:01"
}`
res.Write([]byte(info))
_, err := res.Write([]byte(info))
assert.NoError(t, err)
}
}))
@ -126,7 +130,8 @@ func TestEosioV1TimeInFutureUP(t *testing.T) {
"head_block_time": "2020-09-22T09:32:00"
}`
res.Write([]byte(info))
_, err := res.Write([]byte(info))
assert.NoError(t, err)
}
}))
@ -149,7 +154,8 @@ func TestEosioV1TimeInFutureDown(t *testing.T) {
"head_block_time": "2019-04-14T12:02:01"
}`
res.Write([]byte(info))
_, err := res.Write([]byte(info))
assert.NoError(t, err)
}
}))