github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/db/boltdb/boltdb_test.go (about) 1 package boltdb 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/gnolang/gno/tm2/pkg/db/internal" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func TestBoltDBNew(t *testing.T) { 12 t.Parallel() 13 14 name := fmt.Sprintf("test_%x", internal.RandStr(12)) 15 16 db, err := New(name, t.TempDir()) 17 require.NoError(t, err) 18 db.Close() 19 } 20 21 func BenchmarkBoltDBRandomReadsWrites(b *testing.B) { 22 if testing.Short() { 23 b.Skip("skipping testing in short mode") 24 } 25 26 name := fmt.Sprintf("test_%x", internal.RandStr(12)) 27 db, err := New(name, b.TempDir()) 28 if err != nil { 29 b.Fatal(err) 30 } 31 defer db.Close() 32 33 internal.BenchmarkRandomReadsWrites(b, db) 34 }