forked from tendermint/tm-db
-
Notifications
You must be signed in to change notification settings - Fork 8
/
pebble_test.go
50 lines (40 loc) · 1003 Bytes
/
pebble_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
//go:build pebbledb
package db
import (
"fmt"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestPebbleDBBackend(t *testing.T) {
name := fmt.Sprintf("test_%x", randStr(12))
dir := os.TempDir()
db, err := NewDB(name, PebbleDBBackend, dir)
require.NoError(t, err)
defer cleanupDBDir(dir, name)
_, ok := db.(*PebbleDB)
assert.True(t, ok)
}
// func TestPebbleDBStats(t *testing.T) {
// name := fmt.Sprintf("test_%x", randStr(12))
// dir := os.TempDir()
// db, err := NewDB(name, PebbleDBBackend, dir)
// require.NoError(t, err)
// defer cleanupDBDir(dir, name)
// assert.NotEmpty(t, db.Stats())
// }
func BenchmarkPebbleDBRandomReadsWrites(b *testing.B) {
name := fmt.Sprintf("test_%x", randStr(12))
dir := os.TempDir()
db, err := NewDB(name, PebbleDBBackend, dir)
if err != nil {
b.Fatal(err)
}
defer func() {
db.Close()
cleanupDBDir("", name)
}()
benchmarkRandomReadsWrites(b, db)
}
// TODO: Add tests for pebble