c1f1aacffe
There's no reason it should be at the top-level. Change-Id: I35b06e7baa0e425c6ff9a82964d0a1570d4eb6d0
55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package boltdb
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"storj.io/storj/private/kvstore/testsuite"
|
|
)
|
|
|
|
func TestSuite(t *testing.T) {
|
|
tempdir, err := os.MkdirTemp("", "storj-bolt")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer func() { _ = os.RemoveAll(tempdir) }()
|
|
|
|
dbname := filepath.Join(tempdir, "bolt.db")
|
|
store, err := New(dbname, "bucket")
|
|
if err != nil {
|
|
t.Fatalf("failed to create db: %v", err)
|
|
}
|
|
defer func() {
|
|
if err := store.Close(); err != nil {
|
|
t.Fatalf("failed to close db: %v", err)
|
|
}
|
|
}()
|
|
|
|
testsuite.RunTests(t, store)
|
|
}
|
|
|
|
func BenchmarkSuite(b *testing.B) {
|
|
tempdir, err := os.MkdirTemp("", "storj-bolt")
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
defer func() { _ = os.RemoveAll(tempdir) }()
|
|
|
|
dbname := filepath.Join(tempdir, "bolt.db")
|
|
store, err := New(dbname, "bucket")
|
|
if err != nil {
|
|
b.Fatalf("failed to create db: %v", err)
|
|
}
|
|
defer func() {
|
|
if err := store.Close(); err != nil {
|
|
b.Fatalf("failed to close db: %v", err)
|
|
}
|
|
}()
|
|
|
|
testsuite.RunBenchmarks(b, store)
|
|
}
|