Skip to content

Commit

Permalink
Add test which fails without patch, comment on patch
Browse files Browse the repository at this point in the history
  • Loading branch information
UnitylChaos committed Jul 26, 2018
1 parent 6ea0a1b commit 0166cf2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
17 changes: 17 additions & 0 deletions cmd/gaia/app/app_test.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down Expand Up @@ -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")
}

0 comments on commit 0166cf2

Please sign in to comment.