Skip to content

Commit e803799

Browse files
mason-sharpclaude
andcommitted
tests: defer rows.Close and check rows.Err in test helper
Ensure the cursor is closed even if rows.Scan triggers t.FailNow, and surface any late transport errors after iteration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 56574ad commit e803799

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tests/integration/schema_diff_summary_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ func getAllTablesUnion(t *testing.T, pools []*pgxpool.Pool, schema string) []str
274274
WHERE table_schema = $1 AND table_type = 'BASE TABLE'
275275
ORDER BY table_name`, schema)
276276
require.NoError(t, err)
277+
defer rows.Close()
277278
for rows.Next() {
278279
var name string
279280
require.NoError(t, rows.Scan(&name))
280281
seen[name] = true
281282
}
282-
rows.Close()
283+
require.NoError(t, rows.Err())
283284
}
284285
tables := make([]string, 0, len(seen))
285286
for name := range seen {

0 commit comments

Comments
 (0)