Loading
feat(clients/gitlab): add HealthcheckClient for /check endpoint
Adds `HealthcheckClient` to `internal/clients/gitlab` — a thin wrapper around `GET /api/v4/internal/check` using the new labkit HTTP client. This is the new-client implementation that the FF-gated dispatch (MR3) will call when `use_new_healthcheck_client` is enabled.
What this MR does
- Defines `HealthcheckResponse` and `HealthcheckClient` in `internal/clients/gitlab/healthcheck.go`
- `Check(ctx)` calls `client.Get` then delegates JSON parsing and error handling to the shared `ParseJSON` helper (which returns `*client.APIError` for non-2xx responses and `errors.New("parsing failed")` for invalid JSON)
- Extracts the endpoint path into a `healthcheckPath` package-level constant
- Tests live in `package gitlab_test`, use the shared `newTestClient` helper, and assert against concrete error types (`require.ErrorAs` / `require.EqualError`) rather than just `require.Error`
Test plan
``` go test ./internal/clients/gitlab/... ```
Stack (merge in order)
| # | MR | Status |
|---|---|---|
| 1 | !1465 (merged) — retry policy | merge into `main` first |
| 2 | !1466 (merged) — new HealthcheckClient ← you are here | retarget to `main` after MR1 merges |
| 3 | !1467 (merged) — FF-gated dispatch | retarget to `main` after MR2 merges |
| 4 | !1468 (merged) — acceptance test harness | retarget to `main` after MR3 merges |
Edited by Elliot Forbes