Skip to content

test(config): pgxmock GetExecutionByID tests declare 21 columns but scan reads 22 (token_expires_at) #627

Description

@cristim

Summary

Two pgxmock unit tests in internal/config/store_postgres_pgxmock_test.go fail because their mocked row definitions declare only 21 columns while the production queryExecutions scan reads 22. The 22nd scanned column (token_expires_at, scanned into tokenExpiresAt at store_postgres.go:992) was added without updating these two test mocks.

Failing tests:

  • TestPGXMock_GetExecutionByID_Success
  • TestPGXMock_GetExecutionByID_WithTimestamps

Error: failed to scan execution: incorrect argument number 22 for columns 21

Current behaviour

go test ./internal/config/... fails with 2 failures on the feat/multicloud-web-frontend base branch. Confirmed pre-existing: the failures reproduce on PR #623's HEAD 8b48278f2 after git stash-ing all PR-unrelated changes, so they are not introduced by #623.

Steps to reproduce

git checkout feat/multicloud-web-frontend
go test ./internal/config/... -run 'TestPGXMock_GetExecutionByID'

Expected behaviour

Both tests pass; the mock column set and added row values match the production scan order (22 columns).

Proposed fix

In internal/config/store_postgres_pgxmock_test.go, both test functions (around lines 384-397 and 422-439): append "token_expires_at" to the cols slice and a corresponding 22nd value (sql.NullTime{} for the NULL case, sql.NullTime{Valid: true, Time: future} for the populated case) to the AddRow(...) calls, matching the scan order in internal/config/store_postgres.go (the &tokenExpiresAt scan at line 992). Cross-check that the SELECT column lists at store_postgres.go:697-698, 784-785, 824 include token_expires_at so the mocks mirror the real query shape.

References

Severity

Test-suite breakage in the config package on the shared frontend branch. Not a production-path defect (the production scan is correct), but it blocks a green go test ./internal/config/... and masks future regressions in those tests.

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions