Add test which fails without patch, comment on patch

This commit is contained in:
Jeremiah Andrews 2018-07-25 14:10:07 -07:00
parent 6ea0a1b66f
commit 0166cf2aa0
2 changed files with 18 additions and 0 deletions

View File

@ -190,6 +190,7 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error {
if main == nil {
return errors.New("baseapp expects MultiStore with 'main' KVStore")
}
// Needed for `gaiad export`, which inits from store but never calls initchain
app.setCheckState(abci.Header{})
return nil
}

View File

@ -1,9 +1,15 @@
package app
import (
"os"
"testing"
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/stake"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
abci "github.com/tendermint/tendermint/abci/types"
)
@ -31,3 +37,14 @@ func setGenesis(gapp *GaiaApp, accs ...*auth.BaseAccount) error {
return nil
}
func TestGaiadExport(t *testing.T) {
db := db.NewMemDB()
gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil)
setGenesis(gapp)
// Making a new app object with the db, so that initchain hasn't been called
newGapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil)
_, _, err := newGapp.ExportAppStateAndValidators()
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}