[EPAC-1874]: add integration tests for api v1 live live-status handler#455
Merged
riddim-developer-bot[bot] merged 2 commits intoMay 14, 2026
Conversation
|
Symphony expected a reviewer-bot review for the current autonomous PR head within the configured SLA window, but none was found.
|
There was a problem hiding this comment.
ReviewAutonomousPR
- Verdict:
approve - Reviewer boundary:
review_only - Acceptance criteria coverage: covered=5, missing=0, unclear=0
Summary
The PR satisfies the requested integration-test scope: five named integration-tagged tests were added and they exercise both API-read and scheduled-write paths against live_session using the shared test DB harness and real schema shape. No blocking correctness issues were found.
Actionable findings
- nit / follow_up — Close pgx connections opened by integration helpers (
/Users/sunny/code/epac/backend/live-status/main_integration_test.go:84)setupDatabasecreates a new*pgx.Connper test and never closes it. In integration runs that execute many tests (or reuse processes), leaked connections can accumulate and fail as a separate resource issue rather than a test assertion failure. Addt.Cleanupin the helper toconn.Close(context.Background())or return to callers for explicit closure.- Actionability:
follow_up
Acceptance criteria coverage
- covered — TestLiveStatusAPIRead_FreshRow_ReturnsCurrentStatus
- Added and implemented via
testLiveStatusAPICachedRowwith a seeded row, API call, and assertions on status JSONis_sitting,business_type, andchecked_at. - Actionability:
none - Evidence:
backend/live-status/main_integration_test.go:122
- Added and implemented via
- covered — TestLiveStatusAPIRead_StaleRow_ReturnsStatusWithFlag
- Added stale-row test that seeds an old
checked_atand asserts cached response fields remain in place, documenting that current behavior has no explicit stale flag. - Actionability:
none - Evidence:
backend/live-status/main_integration_test.go:166
- Added stale-row test that seeds an old
- covered — TestLiveStatusAPIRead_NoRow_ReturnsDefault
- Empty-table scenario is exercised and default payload assertions are present (
is_sitting=false,status=unknown,business_type=Adjourned). - Actionability:
none - Evidence:
backend/live-status/main_integration_test.go:176
- Empty-table scenario is exercised and default payload assertions are present (
- covered — TestLiveStatusScheduledWrite_InsertsRow
- Integration test drives scheduled handler with fake upstream and verifies one-row insertion and persisted payload values.
- Actionability:
none - Evidence:
backend/live-status/main_integration_test.go:206
- covered — TestLiveStatusScheduledWrite_UpdatesExistingRow
- Integration test seeds an existing row, executes scheduled path, and verifies row count remains one with updated values.
- Actionability:
none - Evidence:
backend/live-status/main_integration_test.go:236
Human gate reason
No blocking PR-quality issues; merge can proceed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EPAC-1874
Add integration tests for
/api/v1/liveand scheduled live-status cache writes using the shared_testdbharness and reallive_sessiontable.Changes
backend/live-status/main_integration_test.gowith 5 integration tests under//go:build integration:TestLiveStatusAPIRead_FreshRow_ReturnsCurrentStatusTestLiveStatusAPIRead_StaleRow_ReturnsStatusWithFlagTestLiveStatusAPIRead_NoRow_ReturnsDefaultTestLiveStatusScheduledWrite_InsertsRowTestLiveStatusScheduledWrite_UpdatesExistingRowbackend/_testdb/testdb.go:ClearLiveSessionRowsSeedLiveSessionCountLiveSessionRowsLiveSessionRowbackend/_testdb/live_session_testdb.goto avoidConnectredeclaration and keep single source of truth for test DB connect/seeding helpers.Acceptance coverage lock-in
checked_at,is_sitting, andbusiness_typeusing seededlive_sessionrows.is_sitting=false,status=unknown, and defaultbusiness_type.checked_at).live_sessionusing fake House of Commons upstream fetch responses.Verification
cd backend/live-status && go test ./...ok.cd backend/live-status && DATABASE_URL='postgres://postgres:postgres@127.0.0.1:5432/epac_test?sslmode=disable' go test -tags=integration ./...connection refusedon 127.0.0.1:5432).Notes
Reviewer-Boundary: review-only