More tests.

This commit is contained in:
Nuno Cruces
2024-10-19 08:58:55 +01:00
parent fefee692db
commit 9eec439d35
2 changed files with 34 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import (
_ "github.com/ncruces/go-sqlite3/vfs/adiantum"
"github.com/ncruces/go-sqlite3/vfs/memdb"
_ "github.com/ncruces/go-sqlite3/vfs/memdb"
_ "github.com/ncruces/go-sqlite3/vfs/xts"
)
//go:embed testdata/wal.db
@@ -76,6 +77,13 @@ func TestDB_adiantum(t *testing.T) {
"&vfs=adiantum&textkey=correct+horse+battery+staple")
}
func TestDB_xts(t *testing.T) {
t.Parallel()
tmp := filepath.Join(t.TempDir(), "test.db")
testDB(t, "file:"+filepath.ToSlash(tmp)+"?nolock=1"+
"&vfs=xts&textkey=correct+horse+battery+staple")
}
func TestDB_nolock(t *testing.T) {
t.Parallel()
tmp := filepath.Join(t.TempDir(), "test.db")

View File

@@ -20,6 +20,7 @@ import (
"github.com/ncruces/go-sqlite3/vfs"
_ "github.com/ncruces/go-sqlite3/vfs/adiantum"
"github.com/ncruces/go-sqlite3/vfs/memdb"
_ "github.com/ncruces/go-sqlite3/vfs/xts"
)
func TestMain(m *testing.M) {
@@ -100,9 +101,9 @@ func Test_adiantum(t *testing.T) {
var iter int
if testing.Short() {
iter = 1000
iter = 500
} else {
iter = 5000
iter = 2500
}
name := "file:" +
@@ -116,6 +117,29 @@ func Test_adiantum(t *testing.T) {
testIntegrity(t, name)
}
func Test_xts(t *testing.T) {
if !vfs.SupportsFileLocking {
t.Skip("skipping without locks")
}
var iter int
if testing.Short() {
iter = 500
} else {
iter = 2500
}
name := "file:" +
filepath.ToSlash(filepath.Join(t.TempDir(), "test.db")) +
"?vfs=xts" +
"&_pragma=hexkey(e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855)" +
"&_pragma=busy_timeout(10000)" +
"&_pragma=journal_mode(truncate)" +
"&_pragma=synchronous(off)"
testParallel(t, name, iter)
testIntegrity(t, name)
}
func TestMultiProcess(t *testing.T) {
if !vfs.SupportsFileLocking {
t.Skip("skipping without locks")