erigon-pulse/ethdb/storage_mode_test.go
Andrew Ashikhmin cf7b9a75a7
Issue 635: Stage4 to optionally generate persisted receipts (#644)
* Euphemerally -> Ephemerally

* Move StorageMode to ethdb and pass it to PrepareStagedSync

* linter

* Remove StorageModeThinHistory and move SetStorageModeIfNotExist into storage_mode.go

* Optionally write receipts in the execute stage

* memory profiler

* linter

* proper linter fix

* linter

* typo

* Merge stateDb with changeDb so that all-or-nothing is commited in stage_execute
2020-06-09 14:11:09 +01:00

46 lines
607 B
Go

package ethdb
import (
"reflect"
"testing"
"github.com/davecgh/go-spew/spew"
)
func TestSetStorageModeIfNotExist(t *testing.T) {
db := NewMemDatabase()
sm, err := GetStorageModeFromDB(db)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(sm, StorageMode{}) {
t.Fatal()
}
err = SetStorageModeIfNotExist(db, StorageMode{
true,
true,
true,
true,
})
if err != nil {
t.Fatal(err)
}
sm, err = GetStorageModeFromDB(db)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(sm, StorageMode{
true,
true,
true,
true,
}) {
spew.Dump(sm)
t.Fatal("not equal")
}
}