Skip to content

test: un-skip HealthCheckRoutes with nil-pool guard coverage - #377

Open
mrofreP wants to merge 1 commit into
UndernetIRC:masterfrom
mrofreP:test/enable-health-check-nil-pool-guard-test
Open

mrofreP wants to merge 1 commit into
UndernetIRC:masterfrom
mrofreP:test/enable-health-check-nil-pool-guard-test

Conversation

@mrofreP

@mrofreP mrofreP commented Jul 18, 2026

Copy link
Copy Markdown

routes/routes_test.go:263 had TestRouteServiceMethods/HealthCheckRoutes
disabled with t.Skip("Health check test requires a properly
initialized pool"). The skip was overcautious — HealthCheckRoutes
itself only decides whether to register the /health-check route
(if r.pool != nil ...); it does not exercise the pool. Registration
can be verified without a working DB.

Replace the skip stub with a struct-table subtest covering both
branches of the guard:

  • nil pool → /health-check must NOT be registered (safe default when
    the service starts without a working DB)
  • non-nil pool → /health-check MUST be registered

Each case builds a fresh RouteService and calls HealthCheckRoutes(),
then asserts on ee.Routes(). Handler behavior itself is exercised
by controllers/health_check_test.go and is out of scope here.

routes/routes_test.go:263 had TestRouteServiceMethods/HealthCheckRoutes
disabled with t.Skip("Health check test requires a properly
initialized pool"). The skip was overcautious — HealthCheckRoutes
itself only decides whether to register the /health-check route
(if r.pool != nil ...); it does not exercise the pool. Registration
can be verified without a working DB.

Replace the skip stub with a struct-table subtest covering both
branches of the guard:

- nil pool → /health-check must NOT be registered (safe default when
  the service starts without a working DB)
- non-nil pool → /health-check MUST be registered

Each case builds a fresh RouteService and calls HealthCheckRoutes(),
then asserts on ee.Routes(). Handler behavior itself is exercised
by controllers/health_check_test.go and is out of scope here.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant