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
/
rocksdb_test.go
53 lines (38 loc) · 1.32 KB
/
rocksdb_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
//go:build rocksdb
// +build rocksdb
package db
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRocksDBNewDB(t *testing.T) {
db, dir, name := newDB(t, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
_, ok := db.(*RocksDB)
assert.True(t, ok)
}
func TestRocksDBStats(t *testing.T) {
db, dir, name := newDB(t, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
assert.NotEmpty(t, db.Stats())
}
func BenchmarkRocksDBRangeScans1M(b *testing.B) {
db, dir, name := newDB(b, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
benchmarkRangeScans(b, db, int64(1e6))
}
func BenchmarkRocksDBRangeScans10M(b *testing.B) {
db, dir, name := newDB(b, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
benchmarkRangeScans(b, db, int64(10e6))
}
func BenchmarkRocksDBRandomReadsWrites(b *testing.B) {
db, dir, name := newDB(b, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
benchmarkRandomReadsWrites(b, db)
}
func BenchmarkRocksDBParallelRandomReadsWrites(b *testing.B) {
db, dir, name := newDB(b, RocksDBBackend)
defer cleanupDBDir(dir, name) // Cannot use `closeDBWithCleanupDBDir`
benchmarkParallelRandomReadsWrites(b, db)
}