This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
boltdb_test.go
57 lines (42 loc) · 1.43 KB
/
boltdb_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//go:build boltdb
// +build boltdb
package db
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBoltDBNewDB(t *testing.T) {
db, dir, name := newDB(t, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
_, ok := db.(*BoltDB)
assert.True(t, ok)
}
func TestBoltDBStats(t *testing.T) {
db, dir, name := newDB(t, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
assert.NotEmpty(t, db.Stats())
}
// Cannot work well since the data setup time is long (10min over)
// See the read/write performance: BenchmarkBoltDBRandomReadsWrites
func TempBenchmarkBoltDBRangeScans1M(b *testing.B) {
db, dir, name := newDB(b, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
benchmarkRangeScans(b, db, int64(1e6))
}
// Cannot work well since the data setup time is long (10min over)
// See the read/write performance: BenchmarkBoltDBRandomReadsWrites
func TempBenchmarkBoltDBRangeScans10M(b *testing.B) {
db, dir, name := newDB(b, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
benchmarkRangeScans(b, db, int64(10e6))
}
func BenchmarkBoltDBRandomReadsWrites(b *testing.B) {
db, dir, name := newDB(b, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
benchmarkRandomReadsWrites(b, db)
}
func BenchmarkBoltDBParallelRandomReadsWrites(b *testing.B) {
db, dir, name := newDB(b, BoltDBBackend)
defer closeDBWithCleanupDBDir(db, dir, name)
benchmarkParallelRandomReadsWrites(b, db)
}