From b42845043a4da0e9608cd62cdf5a86dc39c691b2 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 27 Apr 2024 14:39:35 +0700 Subject: [PATCH] save --- mdbx/txn_test.go | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/mdbx/txn_test.go b/mdbx/txn_test.go index 6eeccbd..9973e08 100644 --- a/mdbx/txn_test.go +++ b/mdbx/txn_test.go @@ -419,34 +419,14 @@ func TestTxn_OpenDBI_emptyName(t *testing.T) { } func TestTxn_OpenDBI_zero(t *testing.T) { - env, err := NewEnv() - if err != nil { - t.Fatalf("env: %s", err) - } - path := t.TempDir() - err = env.SetOption(OptMaxDB, 1024) - if err != nil { - t.Fatalf("setmaxdbs: %v", err) - } - const pageSize = 4096 - err = env.SetGeometry(-1, -1, 64*1024*pageSize, -1, -1, pageSize) - if err != nil { - t.Fatalf("setmaxdbs: %v", err) - } - err = env.Open(path, 0, 0664) - if err != nil { - t.Fatalf("open: %s", err) - } - t.Cleanup(func() { - env.Close() - }) + env, _ := setup(t) - err = env.View(func(txn *Txn) (err error) { - _, err = txn.OpenRoot(0) + err := env.View(func(txn *Txn) (err error) { + dbi, err := txn.OpenRoot(0) if err != nil { return err } - _, err = txn.Get(0, []byte("k")) + _, err = txn.Get(dbi, []byte("k")) return err }) if !IsErrno(err, BadDBI) {