erigon-pulse/ethdb/storage_mode_test.go
ledgerwatch 8907e95d4a
Trace filter 3 (#1904)
* Prevent the leak

* Default storage mode, fix leak again

* TopSeenHeight to be updated from any header

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-05-08 23:07:16 +01:00

50 lines
656 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{Initialised: true}) {
t.Fatal()
}
err = SetStorageModeIfNotExist(db, StorageMode{
true,
true,
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,
true,
true,
}) {
spew.Dump(sm)
t.Fatal("not equal")
}
}