(t *testing.T)
| 152 | } |
| 153 | |
| 154 | func TestDriverRiverLiteLibSQL(t *testing.T) { //nolint:dupl |
| 155 | t.Parallel() |
| 156 | |
| 157 | var ( |
| 158 | ctx = context.Background() |
| 159 | procurePool = func(ctx context.Context, schema string) (any, string) { |
| 160 | return riversharedtest.DBPoolLibSQL(ctx, t, schema), "" // could also be `main` instead of empty string |
| 161 | } |
| 162 | ) |
| 163 | |
| 164 | riverdrivertest.Exercise(ctx, t, |
| 165 | func(ctx context.Context, t *testing.T, opts *riverdbtest.TestSchemaOpts) (riverdriver.Driver[*sql.Tx], string) { |
| 166 | t.Helper() |
| 167 | |
| 168 | if opts == nil { |
| 169 | opts = &riverdbtest.TestSchemaOpts{} |
| 170 | } |
| 171 | opts.ProcurePool = procurePool |
| 172 | |
| 173 | var ( |
| 174 | // Driver will have its pool set by TestSchema. |
| 175 | driver = riversqlite.New(nil) |
| 176 | schema = riverdbtest.TestSchema(ctx, t, driver, opts) |
| 177 | ) |
| 178 | return driver, schema |
| 179 | }, |
| 180 | func(ctx context.Context, t *testing.T) (riverdriver.Executor, riverdriver.Driver[*sql.Tx]) { |
| 181 | t.Helper() |
| 182 | |
| 183 | // Driver will have its pool set by TestSchema. |
| 184 | driver := riversqlite.New(nil) |
| 185 | |
| 186 | tx, _ := riverdbtest.TestTx(ctx, t, driver, &riverdbtest.TestTxOpts{ |
| 187 | // Unfortunately, the normal test transaction schema sharing has |
| 188 | // to be disabled for SQLite. When enabled, there's too much |
| 189 | // contention on the shared test databases and operations fail |
| 190 | // with `database is locked (5) (SQLITE_BUSY)`, which is a |
| 191 | // common concurrency error in SQLite whose recommended |
| 192 | // remediation is a backoff and retry. I tried various |
| 193 | // techniques like journal_mode=WAL, but it didn't seem to help |
| 194 | // enough. SQLite databases are just local files anyway, and |
| 195 | // test transactions can still reuse schemas freed by other |
| 196 | // tests through TestSchema, so this should be okay performance |
| 197 | // wise. |
| 198 | DisableSchemaSharing: true, |
| 199 | |
| 200 | ProcurePool: procurePool, |
| 201 | }) |
| 202 | return driver.UnwrapExecutor(tx), driver |
| 203 | }) |
| 204 | } |
| 205 | |
| 206 | func TestDriverRiverSQLiteModernC(t *testing.T) { //nolint:dupl |
| 207 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…