mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
use in-mem db in tests (#800)
This commit is contained in:
parent
afe3703d28
commit
d2603c5730
@ -19,7 +19,7 @@ func testDbAndAggregatorBench(b *testing.B, prefixLen int, aggStep uint64) (stri
|
||||
path := b.TempDir()
|
||||
b.Cleanup(func() { os.RemoveAll(path) })
|
||||
logger := log.New()
|
||||
db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
db := mdbx.NewMDBX(logger).InMem(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.ChaindataTablesCfg
|
||||
}).MustOpen()
|
||||
b.Cleanup(db.Close)
|
||||
|
@ -24,7 +24,7 @@ func testDbAndAggregator(t *testing.T, prefixLen int, aggStep uint64) (string, k
|
||||
path := t.TempDir()
|
||||
t.Cleanup(func() { os.RemoveAll(path) })
|
||||
logger := log.New()
|
||||
db := mdbx.NewMDBX(logger).Path(filepath.Join(path, "db4")).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
db := mdbx.NewMDBX(logger).InMem(filepath.Join(path, "db4")).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.ChaindataTablesCfg
|
||||
}).MustOpen()
|
||||
t.Cleanup(db.Close)
|
||||
@ -259,7 +259,7 @@ func TestAggregator_RestartOnFiles(t *testing.T) {
|
||||
|
||||
require.NoError(t, os.RemoveAll(filepath.Join(path, "db4")))
|
||||
|
||||
newDb, err := mdbx.NewMDBX(log.New()).Path(filepath.Join(path, "db4")).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
newDb, err := mdbx.NewMDBX(log.New()).InMem(filepath.Join(path, "db4")).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.ChaindataTablesCfg
|
||||
}).Open()
|
||||
require.NoError(t, err)
|
||||
|
@ -47,7 +47,7 @@ func testDbAndDomain(t *testing.T, prefixLen int) (string, kv.RwDB, *Domain) {
|
||||
historyValsTable := "HistoryVals"
|
||||
settingsTable := "Settings"
|
||||
indexTable := "Index"
|
||||
db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
db := mdbx.NewMDBX(logger).InMem(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.TableCfg{
|
||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||
valsTable: kv.TableCfgItem{},
|
||||
|
@ -43,7 +43,7 @@ func testDbAndHistory(tb testing.TB) (string, kv.RwDB, *History) {
|
||||
indexTable := "Index"
|
||||
valsTable := "Vals"
|
||||
settingsTable := "Settings"
|
||||
db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
db := mdbx.NewMDBX(logger).InMem(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.TableCfg{
|
||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||
indexTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||
|
@ -43,7 +43,7 @@ func testDbAndInvertedIndex(t *testing.T, aggStep uint64) (string, kv.RwDB, *Inv
|
||||
logger := log.New()
|
||||
keysTable := "Keys"
|
||||
indexTable := "Index"
|
||||
db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
db := mdbx.NewMDBX(logger).InMem(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg {
|
||||
return kv.TableCfg{
|
||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||
indexTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||
|
Loading…
Reference in New Issue
Block a user