1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-03 11:53:43 +02:00

src/api/test.go: rename from TestApi to DebugApi

This commit is contained in:
Henrik Hautakoski 2022-10-03 16:15:25 +02:00
parent bda40bf1d5
commit edb063722b
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
2 changed files with 10 additions and 10 deletions

View file

@ -6,7 +6,7 @@ import (
"github.com/eosswedenorg-go/haproxy/agentcheck" "github.com/eosswedenorg-go/haproxy/agentcheck"
) )
type TestApi struct { type DebugApi struct {
response agentcheck.Response response agentcheck.Response
} }
@ -25,22 +25,22 @@ func parseResponse(resp string) (agentcheck.Response, error) {
return agentcheck.NewStatusResponse(rtype), nil return agentcheck.NewStatusResponse(rtype), nil
} }
func NewTestApi(response string) TestApi { func NewDebugApi(response string) DebugApi {
resp, _ := parseResponse(response) resp, _ := parseResponse(response)
return TestApi{ return DebugApi{
response: resp, response: resp,
} }
} }
func (t TestApi) LogInfo() LogParams { func (d DebugApi) LogInfo() LogParams {
return LogParams{ return LogParams{
"type", "TestApi", "type", "Debug",
"response", t.response, "response", strings.TrimSpace(d.response.String()),
} }
} }
func (t TestApi) Call() (agentcheck.Response, string) { func (d DebugApi) Call() (agentcheck.Response, string) {
return t.response, "" return d.response, ""
} }

View file

@ -58,8 +58,8 @@ func ParseRequest(request string) (api.ApiInterface, error) {
return api.NewEosioV2(a.url, a.host, int64(a.num_blocks)), nil return api.NewEosioV2(a.url, a.host, int64(a.num_blocks)), nil
case "contract": case "contract":
return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil
case "test": case "debug":
return api.NewTestApi(a.url), nil return api.NewDebugApi(a.url), nil
} }
return nil, fmt.Errorf("Invalid API '%s'", p[0]) return nil, fmt.Errorf("Invalid API '%s'", p[0])