(t testing.TB)
| 95 | } |
| 96 | |
| 97 | func testSQLDB(t testing.TB) *sql.DB { |
| 98 | t.Helper() |
| 99 | |
| 100 | connection, err := dbtestutil.Open(t) |
| 101 | require.NoError(t, err) |
| 102 | |
| 103 | db, err := sql.Open("postgres", connection) |
| 104 | require.NoError(t, err) |
| 105 | t.Cleanup(func() { _ = db.Close() }) |
| 106 | |
| 107 | // dbtestutil.Open automatically runs migrations, but we want to actually test |
| 108 | // migration behavior in this package. |
| 109 | _, err = db.Exec(`DROP SCHEMA public CASCADE`) |
| 110 | require.NoError(t, err) |
| 111 | _, err = db.Exec(`CREATE SCHEMA public`) |
| 112 | require.NoError(t, err) |
| 113 | |
| 114 | return db |
| 115 | } |
| 116 | |
| 117 | // paralleltest linter doesn't correctly handle table-driven tests (https://github.com/kunwardeep/paralleltest/issues/8) |
| 118 | // nolint:paralleltest |
no test coverage detected