Skip to content

Commit 80e7396

Browse files
committed
fix(test): align GetExecutionByID twin test with (nil, nil) contract
Sibling-consistency miss from 1017f66 (which aligned the test in internal/config/store_postgres_db_test.go to the contract that GetExecutionByID returns (nil, nil) for missing rows): the duplicate "Get execution by ID - not found" subtest in store_postgres_test.go was left on the pre-contract `assert.Error + err.Error()` shape, so the Integration Tests job panicked with a nil-pointer deref the moment it tried to format the nil err. The panic cascaded through TestPostgresStore_PurchaseExecutions and aborted the rest of the internal/config suite -- visible in the PR's failing CI as `SIGSEGV ... store_postgres_test.go:313`. Bring this twin test in line with the contract documented in 1017f66 and the sibling subtest at store_postgres_db_test.go:594: expect (nil, nil), assert the returned execution is nil, no err deref. GetExecutionByPlanAndDate's not-found assertion below stays as-is -- that one DOES wrap a "not found" error (store_postgres.go:1317).
1 parent 26063f9 commit 80e7396

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

internal/config/store_postgres_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,15 @@ func TestPostgresStore_PurchaseExecutions(t *testing.T) {
307307
})
308308

309309
t.Run("Get execution by ID - not found", func(t *testing.T) {
310-
// Use a valid UUID format that doesn't exist
311-
_, err := store.GetExecutionByID(ctx, "00000000-0000-0000-0000-000000000000")
312-
assert.Error(t, err)
313-
assert.Contains(t, err.Error(), "not found")
310+
// Use a valid UUID format that doesn't exist.
311+
// Contract: GetExecutionByID returns (nil, nil) on not-found; every
312+
// caller maps the nil execution to its own not-found error. The
313+
// sibling assertion in store_postgres_db_test.go was aligned to this
314+
// contract in 1017f66a8; this twin test panicked with a nil-pointer
315+
// deref on err.Error() until brought in line here.
316+
exec, err := store.GetExecutionByID(ctx, "00000000-0000-0000-0000-000000000000")
317+
require.NoError(t, err)
318+
assert.Nil(t, exec)
314319
})
315320

316321
t.Run("Get execution by plan and date - not found", func(t *testing.T) {

0 commit comments

Comments
 (0)