mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07: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()
|
path := b.TempDir()
|
||||||
b.Cleanup(func() { os.RemoveAll(path) })
|
b.Cleanup(func() { os.RemoveAll(path) })
|
||||||
logger := log.New()
|
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
|
return kv.ChaindataTablesCfg
|
||||||
}).MustOpen()
|
}).MustOpen()
|
||||||
b.Cleanup(db.Close)
|
b.Cleanup(db.Close)
|
||||||
|
@ -24,7 +24,7 @@ func testDbAndAggregator(t *testing.T, prefixLen int, aggStep uint64) (string, k
|
|||||||
path := t.TempDir()
|
path := t.TempDir()
|
||||||
t.Cleanup(func() { os.RemoveAll(path) })
|
t.Cleanup(func() { os.RemoveAll(path) })
|
||||||
logger := log.New()
|
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
|
return kv.ChaindataTablesCfg
|
||||||
}).MustOpen()
|
}).MustOpen()
|
||||||
t.Cleanup(db.Close)
|
t.Cleanup(db.Close)
|
||||||
@ -259,7 +259,7 @@ func TestAggregator_RestartOnFiles(t *testing.T) {
|
|||||||
|
|
||||||
require.NoError(t, os.RemoveAll(filepath.Join(path, "db4")))
|
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
|
return kv.ChaindataTablesCfg
|
||||||
}).Open()
|
}).Open()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -47,7 +47,7 @@ func testDbAndDomain(t *testing.T, prefixLen int) (string, kv.RwDB, *Domain) {
|
|||||||
historyValsTable := "HistoryVals"
|
historyValsTable := "HistoryVals"
|
||||||
settingsTable := "Settings"
|
settingsTable := "Settings"
|
||||||
indexTable := "Index"
|
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{
|
return kv.TableCfg{
|
||||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||||
valsTable: kv.TableCfgItem{},
|
valsTable: kv.TableCfgItem{},
|
||||||
|
@ -43,7 +43,7 @@ func testDbAndHistory(tb testing.TB) (string, kv.RwDB, *History) {
|
|||||||
indexTable := "Index"
|
indexTable := "Index"
|
||||||
valsTable := "Vals"
|
valsTable := "Vals"
|
||||||
settingsTable := "Settings"
|
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{
|
return kv.TableCfg{
|
||||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||||
indexTable: 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()
|
logger := log.New()
|
||||||
keysTable := "Keys"
|
keysTable := "Keys"
|
||||||
indexTable := "Index"
|
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{
|
return kv.TableCfg{
|
||||||
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
keysTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||||
indexTable: kv.TableCfgItem{Flags: kv.DupSort},
|
indexTable: kv.TableCfgItem{Flags: kv.DupSort},
|
||||||
|
Loading…
Reference in New Issue
Block a user