Update importer test to not prune
This commit is contained in:
parent
f07b741388
commit
ef10c845c7
@ -6,10 +6,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"sort"
|
"sort"
|
||||||
"syscall"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -136,13 +134,11 @@ func TestImportBlocks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
db := dbm.NewDB("state", dbm.LevelDBBackend, flagDataDir)
|
db := dbm.NewDB("state", dbm.LevelDBBackend, flagDataDir)
|
||||||
cb := func() {
|
defer func() {
|
||||||
fmt.Println("cleaning up")
|
fmt.Println("cleaning up")
|
||||||
os.RemoveAll(flagDataDir)
|
os.RemoveAll(flagDataDir)
|
||||||
pprof.StopCPUProfile()
|
pprof.StopCPUProfile()
|
||||||
}
|
}()
|
||||||
|
|
||||||
trapSignal(cb)
|
|
||||||
|
|
||||||
// create logger, codec and root multi-store
|
// create logger, codec and root multi-store
|
||||||
cdc := newTestCodec()
|
cdc := newTestCodec()
|
||||||
@ -161,6 +157,8 @@ func TestImportBlocks(t *testing.T) {
|
|||||||
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, nil)
|
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cms.SetPruning(sdk.PruneNothing)
|
||||||
|
|
||||||
// load latest version (root)
|
// load latest version (root)
|
||||||
err := cms.LoadLatestVersion()
|
err := cms.LoadLatestVersion()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -232,7 +230,7 @@ func TestImportBlocks(t *testing.T) {
|
|||||||
_, _, err = ethcore.ApplyTransaction(
|
_, _, err = ethcore.ApplyTransaction(
|
||||||
chainConfig, chainContext, nil, gp, stateDB, header, tx, usedGas, vmConfig,
|
chainConfig, chainContext, nil, gp, stateDB, header, tx, usedGas, vmConfig,
|
||||||
)
|
)
|
||||||
require.NoError(t, err, "failed to apply tx at block %d; tx: %d", block.NumberU64(), tx.Hash())
|
require.NoError(t, err, "failed to apply tx at block %d; tx: %X", block.NumberU64(), tx.Hash())
|
||||||
|
|
||||||
msCache.Write()
|
msCache.Write()
|
||||||
}
|
}
|
||||||
@ -246,19 +244,3 @@ func TestImportBlocks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func trapSignal(cb func()) {
|
|
||||||
c := make(chan os.Signal)
|
|
||||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
recv := <-c
|
|
||||||
fmt.Printf("existing; signal: %s\n", recv)
|
|
||||||
|
|
||||||
if cb != nil {
|
|
||||||
cb()
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(0)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user