Chore: Disable cgo for postgres/mysql tests (#109444)

* disable cgo for postgres/mysql tests

* add missing error constants
This commit is contained in:
Serge Zaitsev
2025-08-11 14:40:44 +02:00
committed by GitHub
parent e0404f924c
commit 7cde0dfaf5
2 changed files with 24 additions and 3 deletions
+22 -1
View File
@@ -2,7 +2,28 @@
package sqlite
import "modernc.org/sqlite"
import (
"database/sql"
"errors"
"modernc.org/sqlite"
)
const DriverName = "sqlite"
// The errors below are used in tests to simulate specific SQLite errors. It's a temporary solution
// until we rewrite the tests not to depend on the sqlite3 package internals directly.
// Note: Since modernc.org/sqlite driver does not expose error codes like sqlite3, we cannot use the same approach.
var (
TestErrUniqueConstraintViolation = errors.New("unique constraint violation (simulated)")
TestErrBusy = errors.New("database is busy (simulated)")
TestErrLocked = errors.New("database is locked (simulated)")
)
func init() {
// alias the driver name to match the CGo driver
sql.Register("sqlite3", &Driver{})
}
//
// FIXME (@zserge)