mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
* libs/db: conditional compilation For cleveldb: go build -tags cleveldb For boltdb: go build -tags boltdb Fixes #3611 * document db_backend param better * remove deprecated LevelDBBackend * update changelog * add missing lines * add new line * fix TestRemoteDB * add a line about boltdb tag * Revert "remove deprecated LevelDBBackend" This reverts commit 1aa85453f76605e0c4d967601bbe26240e668d51. * make PR non breaking * change DEPRECATED label format https://stackoverflow.com/a/36360323/820520
38 lines
642 B
Go
38 lines
642 B
Go
// +build boltdb
|
|
|
|
package db
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
cmn "github.com/tendermint/tendermint/libs/common"
|
|
)
|
|
|
|
func TestBoltDBNewBoltDB(t *testing.T) {
|
|
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
|
|
dir := os.TempDir()
|
|
defer cleanupDBDir(dir, name)
|
|
|
|
db, err := NewBoltDB(name, dir)
|
|
require.NoError(t, err)
|
|
db.Close()
|
|
}
|
|
|
|
func BenchmarkBoltDBRandomReadsWrites(b *testing.B) {
|
|
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
|
|
db, err := NewBoltDB(name, "")
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
defer func() {
|
|
db.Close()
|
|
cleanupDBDir("", name)
|
|
}()
|
|
|
|
benchmarkRandomReadsWrites(b, db)
|
|
}
|