mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
83e65fdd81
fix build add storage mode check add intermitiate migration state&snapshot migrations
51 lines
686 B
Go
51 lines
686 B
Go
package eth
|
|
|
|
import (
|
|
"github.com/davecgh/go-spew/spew"
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestSetStorageModeIfNotExist(t *testing.T) {
|
|
db := ethdb.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,
|
|
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")
|
|
}
|
|
|
|
}
|