From ef10c845c7f2c6aad76ef6a89327af0cf10e8786 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 4 Oct 2018 17:51:19 -0400 Subject: [PATCH] Update importer test to not prune --- importer/importer_test.go | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/importer/importer_test.go b/importer/importer_test.go index 3f708995..3a6fa0e2 100644 --- a/importer/importer_test.go +++ b/importer/importer_test.go @@ -6,10 +6,8 @@ import ( "fmt" "io" "os" - "os/signal" "runtime/pprof" "sort" - "syscall" "testing" "time" @@ -136,13 +134,11 @@ func TestImportBlocks(t *testing.T) { } db := dbm.NewDB("state", dbm.LevelDBBackend, flagDataDir) - cb := func() { + defer func() { fmt.Println("cleaning up") os.RemoveAll(flagDataDir) pprof.StopCPUProfile() - } - - trapSignal(cb) + }() // create logger, codec and root multi-store cdc := newTestCodec() @@ -161,6 +157,8 @@ func TestImportBlocks(t *testing.T) { cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, nil) } + cms.SetPruning(sdk.PruneNothing) + // load latest version (root) err := cms.LoadLatestVersion() require.NoError(t, err) @@ -232,7 +230,7 @@ func TestImportBlocks(t *testing.T) { _, _, err = ethcore.ApplyTransaction( 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() } @@ -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) - }() -}