Maint: healthcheck package interface rework

- return concrete struct type
- Add compilation checks for implementations
This commit is contained in:
Quentin McGaw (desktop)
2021-07-23 19:22:41 +00:00
parent c39ff5c233
commit 54610866f2
6 changed files with 64 additions and 54 deletions

View File

@@ -31,10 +31,10 @@ func (c *CLI) HealthCheck(ctx context.Context, env params.Env,
const timeout = 10 * time.Second
httpClient := &http.Client{Timeout: timeout}
healthchecker := healthcheck.NewChecker(httpClient)
client := healthcheck.NewClient(httpClient)
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
url := "http://127.0.0.1:" + port
return healthchecker.Check(ctx, url)
return client.Check(ctx, url)
}