]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/sqlite/sqlite-storage_test.go
gorond test files
[btrtrc.git] / storage / sqlite / sqlite-storage_test.go
index e63f7bc8bcf43927851b31d26ba4575291d50f4f..d2f16af7ee0449911b3cb0ea855243d64244f14c 100644 (file)
@@ -1,3 +1,6 @@
+//go:build cgo
+// +build cgo
+
 package sqliteStorage
 
 import (
@@ -9,12 +12,31 @@ import (
 
        _ "github.com/anacrolix/envpprof"
        "github.com/anacrolix/squirrel"
-       "github.com/anacrolix/torrent/storage"
-       test_storage "github.com/anacrolix/torrent/storage/test"
        "github.com/dustin/go-humanize"
        qt "github.com/frankban/quicktest"
+
+       "github.com/anacrolix/torrent/storage"
+       test_storage "github.com/anacrolix/torrent/storage/test"
+       "github.com/anacrolix/torrent/test"
 )
 
+func TestLeecherStorage(t *testing.T) {
+       test.TestLeecherStorage(t, test.LeecherStorageTestCase{
+               "SqliteDirect",
+               func(s string) storage.ClientImplCloser {
+                       path := filepath.Join(s, "sqlite3.db")
+                       var opts NewDirectStorageOpts
+                       opts.Path = path
+                       cl, err := NewDirectStorage(opts)
+                       if err != nil {
+                               panic(err)
+                       }
+                       return cl
+               },
+               0,
+       })
+}
+
 func BenchmarkMarkComplete(b *testing.B) {
        const pieceSize = test_storage.DefaultPieceSize
        const noTriggers = false