import (
"errors"
"fmt"
+ _ "github.com/anacrolix/envpprof"
+ "github.com/anacrolix/squirrel"
+ "github.com/dustin/go-humanize"
+ qt "github.com/frankban/quicktest"
"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/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
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")