updated sqlite engine to address compilation errors
All checks were successful
Build and Release Core / Test and Build (push) Successful in 2m54s
All checks were successful
Build and Release Core / Test and Build (push) Successful in 2m54s
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
// runChaosEngine fires 100 concurrent workers at the provided database connection
|
||||
@@ -73,8 +73,8 @@ func TestSQLiteConcurrency_Tuned_Succeeds(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
dbPath := filepath.Join(tempDir, "tuned.db")
|
||||
|
||||
dsn := fmt.Sprintf("%s?_journal_mode=WAL&_synchronous=NORMAL&_busy_timeout=5000", dbPath)
|
||||
db, err := sql.Open("sqlite3", dsn)
|
||||
dsn := fmt.Sprintf("%s?_pragma=journal_mode(WAL)&_pragma=synchronous(NORMAL)&_pragma=busy_timeout(5000)", dbPath)
|
||||
db, err := sql.Open("sqlite", dsn)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open tuned DB: %v", err)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"epigas.gitea.cloud/RiskRancher/core/pkg/domain"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
//go:embed schema.sql
|
||||
@@ -19,9 +19,10 @@ var schemaSQL string
|
||||
var defaultAdaptersFS embed.FS
|
||||
|
||||
func InitDB(filepath string) *sql.DB {
|
||||
dsn := "file:" + filepath + "?_journal=WAL&_timeout=5000&_sync=1&_fk=1"
|
||||
|
||||
db, err := sql.Open("sqlite3", dsn)
|
||||
dsn := "file:" + filepath + "?_pragma=journal_mode(WAL)&_pragma=busy_timeout(5000)&_pragma=synchronous(NORMAL)&_pragma=foreign_keys(1)"
|
||||
|
||||
db, err := sql.Open("sqlite", dsn)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open database: %v", err)
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"epigas.gitea.cloud/RiskRancher/core/pkg/domain"
|
||||
_ "github.com/mattn/go-sqlite3" // We need the SQLite driver for the test
|
||||
_ "modernc.org/sqlite" // We need the SQLite driver for the test
|
||||
)
|
||||
|
||||
func setupTestDB(t *testing.T) *SQLiteStore {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
db, err := sql.Open("sqlite", ":memory:")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open in-memory SQLite database: %v", err)
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"database/sql"
|
||||
"testing"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
func TestSchemaMigrations(t *testing.T) {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
db, err := sql.Open("sqlite", ":memory:")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open test db: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user