From 4b6e481c3f991f0a3be02114edc912760d289b2c Mon Sep 17 00:00:00 2001 From: Eric Warehime Date: Thu, 14 Dec 2023 09:53:25 -0800 Subject: [PATCH] test: Update networksuite with testapp builder (#304) --- testutils/networksuite/networksuite.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/testutils/networksuite/networksuite.go b/testutils/networksuite/networksuite.go index 2750135..faafa15 100644 --- a/testutils/networksuite/networksuite.go +++ b/testutils/networksuite/networksuite.go @@ -3,6 +3,14 @@ package networksuite import ( "math/rand" + "os" + + "cosmossdk.io/log" + pruningtypes "cosmossdk.io/store/pruning/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/baseapp" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "cosmossdk.io/math" "github.com/cosmos/gogoproto/proto" @@ -31,9 +39,22 @@ type NetworkTestSuite struct { // SetupSuite setups the local network with a genesis state. func (nts *NetworkTestSuite) SetupSuite() { var ( - r = sample.Rand() - cfg = network.NewConfig(app.AppConfig) + r = sample.Rand() + cfg = network.NewConfig(app.AppConfig) + appCons = func(val network.ValidatorI) servertypes.Application { + return app.New( + log.NewLogger(os.Stdout), + dbm.NewMemDB(), + nil, + true, + simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir), + baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), + baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), + baseapp.SetChainID(cfg.ChainID), + ) + } ) + cfg.AppConstructor = appCons updateGenesisConfigState := func(moduleName string, moduleState proto.Message) { buf, err := cfg.Codec.MarshalJSON(moduleState)