From 777415af8d5bfe3df35986b6cdf8c1e181c57232 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Fri, 22 May 2026 12:28:32 +0200 Subject: [PATCH] test(config): add token_expires_at column to pgxmock GetExecutionByID rows The production queryExecutions scan reads 22 columns; the mock row definitions in TestPGXMock_GetExecutionByID_Success and TestPGXMock_GetExecutionByID_WithTimestamps only declared 21, causing "incorrect argument number 22 for columns 21" at scan time. Add "approval_token_expires_at" as the 22nd column (after retry_attempt_n, matching the SELECT and rows.Scan order in store_postgres.go) and supply sql.NullTime{} as its value in both rows. Closes #627, Closes #624 --- internal/config/store_postgres_pgxmock_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/config/store_postgres_pgxmock_test.go b/internal/config/store_postgres_pgxmock_test.go index cadff3c1d..08dc89e13 100644 --- a/internal/config/store_postgres_pgxmock_test.go +++ b/internal/config/store_postgres_pgxmock_test.go @@ -387,6 +387,7 @@ func TestPGXMock_GetExecutionByID_Success(t *testing.T) { "total_upfront_cost", "estimated_savings", "completed_at", "error", "expires_at", "cloud_account_id", "source", "approved_by", "cancelled_by", "capacity_percent", "created_by_user_id", "retry_execution_id", "retry_attempt_n", + "approval_token_expires_at", } rows := pgxmock.NewRows(cols).AddRow( "plan-1", "exec-1", "pending", 1, now, @@ -394,6 +395,7 @@ func TestPGXMock_GetExecutionByID_Success(t *testing.T) { 100.0, 200.0, sql.NullTime{}, "", sql.NullTime{}, nil, "", nil, nil, 100, nil, nil, 0, + sql.NullTime{}, ) mock.ExpectQuery("SELECT").WithArgs(pgxmock.AnyArg()).WillReturnRows(rows) @@ -425,6 +427,7 @@ func TestPGXMock_GetExecutionByID_WithTimestamps(t *testing.T) { "total_upfront_cost", "estimated_savings", "completed_at", "error", "expires_at", "cloud_account_id", "source", "approved_by", "cancelled_by", "capacity_percent", "created_by_user_id", "retry_execution_id", "retry_attempt_n", + "approval_token_expires_at", } successorID := "exec-3" rows := pgxmock.NewRows(cols).AddRow( @@ -436,6 +439,7 @@ func TestPGXMock_GetExecutionByID_WithTimestamps(t *testing.T) { // Populated retry-linkage fields (CR #168 nit) — NON-zero // values exercise the scan path for both new columns. nil, &successorID, 2, + sql.NullTime{}, ) mock.ExpectQuery("SELECT").WithArgs(pgxmock.AnyArg()).WillReturnRows(rows)