sqldb: bump modernc.org/sqlite to 1.29.10 which fixes init data race

Tracking issue: https://gitlab.com/cznic/sqlite/-/issues/180
This commit is contained in:
Andras Banki-Horvath
2024-06-21 18:40:03 +02:00
parent e45ed86263
commit 892561f8f0
6 changed files with 9 additions and 23 deletions

View File

@@ -6,7 +6,6 @@ import (
"database/sql"
"fmt"
"math"
"sync"
"testing"
"testing/quick"
"time"
@@ -24,12 +23,6 @@ import (
"github.com/stretchr/testify/require"
)
// sqliteConstructorMu is used to ensure that only one thread can call the
// sqldb.NewTestSqliteDB constructor at a time. This is a temporary workaround
// that can be removed once this race condition in the sqlite repo is resolved:
// https://gitlab.com/cznic/sqlite/-/issues/180
var sqliteConstructorMu sync.Mutex
// TestInvoiceRegistry is a master test which encompasses all tests using an
// InvoiceDB instance. The purpose of this test is to be able to run all tests
// with a custom DB instance, so that we can test the same logic with different
@@ -137,9 +130,7 @@ func TestInvoiceRegistry(t *testing.T) {
var db *sqldb.BaseDB
if sqlite {
sqliteConstructorMu.Lock()
db = sqldb.NewTestSqliteDB(t).BaseDB
sqliteConstructorMu.Unlock()
} else {
db = sqldb.NewTestPostgresDB(t, pgFixture).BaseDB
}

View File

@@ -234,9 +234,7 @@ func TestInvoices(t *testing.T) {
makeSQLDB := func(t *testing.T, sqlite bool) invpkg.InvoiceDB {
var db *sqldb.BaseDB
if sqlite {
sqliteConstructorMu.Lock()
db = sqldb.NewTestSqliteDB(t).BaseDB
sqliteConstructorMu.Unlock()
} else {
db = sqldb.NewTestPostgresDB(t, pgFixture).BaseDB
}