]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/sqlite/sqlite-storage_test.go
gorond
[btrtrc.git] / storage / sqlite / sqlite-storage_test.go
index 66293cfad3258172f8b75b2b77c2e2f46522a396..a566322d708b5d78075e983684f58d4f3d698ae1 100644 (file)
@@ -8,16 +8,34 @@ import (
        "fmt"
        "path/filepath"
        "testing"
-       "time"
 
        _ "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
@@ -49,8 +67,6 @@ func BenchmarkMarkComplete(b *testing.B) {
                                var opts NewDirectStorageOpts
                                opts.Memory = memory
                                opts.Capacity = capacity
-                               // opts.GcBlobs = true
-                               opts.BlobFlushInterval = time.Second
                                opts.NoTriggers = noTriggers
                                directBench := func(b *testing.B) {
                                        opts.Path = filepath.Join(b.TempDir(), "storage.db")