aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-14 04:46:03 -0300
committerEuAndreh <eu@euandre.org>2024-11-14 04:46:03 -0300
commit0687a51cc60ec135b9630b6690d20600a3876318 (patch)
treedc9484a78e0550cce2c2f603201469b547af4153 /tests
parenttests/golite.go: Start dropping using InMemoryUnsafe (diff)
downloadgolite-0687a51cc60ec135b9630b6690d20600a3876318.tar.gz
golite-0687a51cc60ec135b9630b6690d20600a3876318.tar.xz
tests/golite.go: Close stmts that were left open
Diffstat (limited to 'tests')
-rw-r--r--tests/golite.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/golite.go b/tests/golite.go
index 97e991c..2e34c56 100644
--- a/tests/golite.go
+++ b/tests/golite.go
@@ -727,6 +727,7 @@ func TestStmtReadonly(t *testing.T) {
if err != nil {
return false
}
+ defer c.Close()
var ro bool
c.Raw(func(dc any) error {
@@ -738,6 +739,7 @@ func TestStmtReadonly(t *testing.T) {
return errors.New("stmt is nil")
}
ro = stmt.(*SQLiteStmt).Readonly()
+ stmt.Close()
return nil
})
return ro // On errors ro will remain false.
@@ -864,6 +866,7 @@ func TestShortTimeout(t *testing.T) {
}
func TestExecContextCancel(t *testing.T) {
+ // FIXME: too slow
db, err := sql.Open(DriverName, "file:exec?mode=memory&cache=shared")
if err != nil {
t.Fatal(err)
@@ -915,7 +918,9 @@ func TestQueryRowContextCancel(t *testing.T) {
const query = `SELECT key_id FROM test_table ORDER BY key2 ASC`
var keyID string
unexpectedErrors := make(map[string]int)
- for i := 0; i < 10000; i++ {
+ // FIXME: too slow
+ const n = 10000
+ for i := 0; i < n; i++ {
ctx, cancel := context.WithCancel(context.Background())
row := db.QueryRowContext(ctx, query)
@@ -976,7 +981,9 @@ func TestQueryRowContextCancelParallel(t *testing.T) {
}
var keyID string
- for i := 0; i < 10000; i++ {
+ // FIXME: too slow
+ const n = 10000
+ for i := 0; i < n; i++ {
// note that testCtx is not cancelled during query execution
row := db.QueryRowContext(testCtx, query)
@@ -1041,6 +1048,7 @@ func doTestOpenContext(t *testing.T, url string) (string, error) {
}
func TestFileCopyTruncate(t *testing.T) {
+ // FIXME: too slow
var err error
tempFilename := TempFilename(t)
defer os.Remove(tempFilename)
@@ -1188,6 +1196,7 @@ func TestColumnTableName(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ defer stmt.Close()
if exp, got := "foo", stmt.(*SQLiteStmt).ColumnTableName(0); exp != got {
t.Fatalf("Incorrect table name returned expected: %s, got: %s", exp, got)
@@ -1677,6 +1686,7 @@ func TestOpenWithVFS(t *testing.T) {
}
func TestOpenNoCreate(t *testing.T) {
+ // FIXME: too slow
filename := t.Name() + ".sqlite"
if err := os.Remove(filename); err != nil && !os.IsNotExist(err) {
@@ -1735,6 +1745,7 @@ func TestOpenNoCreate(t *testing.T) {
}
func TestReadonly(t *testing.T) {
+ // FIXME: too slow
tempFilename := TempFilename(t)
defer os.Remove(tempFilename)
@@ -2178,7 +2189,6 @@ func TestBoolean(t *testing.T) {
if err != nil {
t.Fatal("Failed to open database:", err)
}
-
defer db.Close()
_, err = db.Exec("CREATE TABLE foo(id INTEGER, fbool BOOLEAN)")
@@ -2595,7 +2605,9 @@ func TestStress(t *testing.T) {
db.Exec("INSERT INTO foo VALUES(1);")
db.Exec("INSERT INTO foo VALUES(2);")
- for i := 0; i < 10000; i++ {
+ // FIXME: too slow
+ const n = 10000
+ for i := 0; i < n; i++ {
for j := 0; j < 3; j++ {
rows, err := db.Query("select * from foo where id=1;")
if err != nil {
@@ -2616,6 +2628,7 @@ func TestStress(t *testing.T) {
}
func TestDateTimeLocal(t *testing.T) {
+ // FIXME: too slow
const zone = "Asia/Tokyo"
tempFilename := TempFilename(t)
defer os.Remove(tempFilename)
@@ -3276,6 +3289,7 @@ func TestNamedParam(t *testing.T) {
var customFunctionOnce sync.Once
func TestSuite(t *testing.T) {
+ // FIXME: too slow
initializeTestDB(t)
defer freeTestDB()
@@ -3531,6 +3545,7 @@ func testTxQuery(t *testing.T) {
}
func testPreparedStmt(t *testing.T) {
+ // FIXME: too slow
tdb.tearDown()
tdb.mustExec("CREATE TABLE t (count INT)")
sel, err := tdb.Prepare("SELECT count FROM t ORDER BY count DESC")
@@ -3653,7 +3668,7 @@ func MainTest() {
{ "TestNilAndEmptyBytes", TestNilAndEmptyBytes },
{ "TestInsertNilByteSlice", TestInsertNilByteSlice },
{ "TestNamedParam", TestNamedParam },
- { "TestSuite", TestSuite }, // FIXME: too slow
+ { "TestSuite", TestSuite },
}
deps := testdeps.TestDeps{}