From ac6acf5d702e4c54d0a428ae5ee2428a84e8a225 Mon Sep 17 00:00:00 2001 From: mpl Date: Fri, 13 Mar 2015 01:02:02 +0100 Subject: [PATCH] index/sqlite tests: let sorted/sqlite pkg do initDB and enable WAL The problem was newSorted was taking care of doing the DB initialization. It was not only unnecessary, since newKeyValueFromConfig from sorted/sqlite will do it by calling initDB, but also incorrect because WAL was not getting enabled. Which is what was causing the "database is locked" error "fixed" in commit f6bf779cd6a8eda505c8392cbbba9d9d0fc4c96e Change-Id: Ib4badeda4ed4c6c4be43d5f7fc4c543a467b0cd1 --- pkg/index/sqlite/sqlite_test.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pkg/index/sqlite/sqlite_test.go b/pkg/index/sqlite/sqlite_test.go index 274f843f9..71ee4b6ff 100644 --- a/pkg/index/sqlite/sqlite_test.go +++ b/pkg/index/sqlite/sqlite_test.go @@ -31,7 +31,7 @@ import ( "camlistore.org/pkg/jsonconfig" "camlistore.org/pkg/sorted" "camlistore.org/pkg/sorted/kvtest" - "camlistore.org/pkg/sorted/sqlite" + _ "camlistore.org/pkg/sorted/sqlite" _ "camlistore.org/third_party/github.com/mattn/go-sqlite3" ) @@ -54,14 +54,6 @@ func newSorted(t *testing.T) (kv sorted.KeyValue, clean func()) { if err != nil { t.Fatal(err) } - db, err := sql.Open("sqlite3", f.Name()) - if err != nil { - t.Fatalf("opening test database: %v", err) - } - for _, tableSql := range sqlite.SQLCreateTables() { - do(db, tableSql) - } - do(db, fmt.Sprintf(`REPLACE INTO meta VALUES ('version', '%d')`, sqlite.SchemaVersion())) kv, err = sorted.NewKeyValue(jsonconfig.Obj{ "type": "sqlite",