[#137] metabase: Implement and useful test funcs for work with DB
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
fc2038e929
commit
7704811654
5 changed files with 31 additions and 84 deletions
|
@ -2,12 +2,10 @@ package meta
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
func addNFilters(fs *objectSDK.SearchFilters, n int) {
|
||||
|
@ -23,17 +21,9 @@ func addNFilters(fs *objectSDK.SearchFilters, n int) {
|
|||
}
|
||||
|
||||
func BenchmarkDB_Select(b *testing.B) {
|
||||
path := "select_test.db"
|
||||
db := newDB(b)
|
||||
|
||||
bdb, err := bbolt.Open(path, 0600, nil)
|
||||
require.NoError(b, err)
|
||||
|
||||
defer func() {
|
||||
bdb.Close()
|
||||
os.Remove(path)
|
||||
}()
|
||||
|
||||
db := NewDB(bdb)
|
||||
defer releaseDB(db)
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
obj := generateObject(b, testPrm{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue