fix: Sims failing and not skipping with empty valset (#16947)
This commit is contained in:
parent
95f2a6d53c
commit
eb0260aa37
@ -167,20 +167,18 @@ func TestAppImportExport(t *testing.T) {
|
||||
err = json.Unmarshal(exported.AppState, &genesisState)
|
||||
require.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
err := fmt.Sprintf("%v", r)
|
||||
if !strings.Contains(err, "validator set is empty after InitGenesis") {
|
||||
panic(r)
|
||||
}
|
||||
logger.Info("Skipping simulation as all validators have been unbonded")
|
||||
logger.Info("err", err, "stacktrace", string(debug.Stack()))
|
||||
}
|
||||
}()
|
||||
|
||||
ctxA := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
|
||||
ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
|
||||
_, err = newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState)
|
||||
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "validator set is empty after InitGenesis") {
|
||||
logger.Info("Skipping simulation as all validators have been unbonded")
|
||||
logger.Info("err", err, "stacktrace", string(debug.Stack()))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
require.NoError(t, err)
|
||||
err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user