feat: add x/group app wiring integration tests (#12243)

## Description

ref: #12024 



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
This commit is contained in:
likhita-809
2022-06-15 05:31:27 +00:00
committed by GitHub
parent d705a8bc8f
commit bfb91ab7bc
9 changed files with 92 additions and 18 deletions
+9 -6
View File
@@ -25,6 +25,7 @@ import (
"google.golang.org/grpc"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
@@ -135,35 +136,37 @@ func DefaultConfigWithAppConfig(appConfig depinject.Config) (Config, error) {
var (
appBuilder *runtime.AppBuilder
msgServiceRouter *baseapp.MsgServiceRouter
txConfig client.TxConfig
legacyAmino *codec.LegacyAmino
codec codec.Codec
cdc codec.Codec
interfaceRegistry codectypes.InterfaceRegistry
)
if err := depinject.Inject(appConfig,
&appBuilder,
&msgServiceRouter,
&txConfig,
&codec,
&cdc,
&legacyAmino,
&interfaceRegistry,
); err != nil {
return Config{}, err
}
cfg.Codec = codec
cfg.Codec = cdc
cfg.TxConfig = txConfig
cfg.LegacyAmino = legacyAmino
cfg.InterfaceRegistry = interfaceRegistry
cfg.GenesisState = appBuilder.DefaultGenesis()
cfg.AppConstructor = func(val Validator) servertypes.Application {
// we build a unique app instance for every validator here
var appBuilder *runtime.AppBuilder
if err := depinject.Inject(appConfig, &appBuilder); err != nil {
panic(err)
}
app := appBuilder.Build(
val.Ctx.Logger,
dbm.NewMemDB(),
nil,
msgServiceRouter,
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.AppConfig.Pruning)),
baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices),
)
+2 -4
View File
@@ -13,7 +13,6 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
@@ -54,17 +53,16 @@ func Setup(appConfig depinject.Config, extraOutputs ...interface{}) (*runtime.Ap
// create app
//
var appBuilder *runtime.AppBuilder
var msgServiceRouter *baseapp.MsgServiceRouter
var codec codec.Codec
if err := depinject.Inject(
appConfig,
append(extraOutputs, &appBuilder, &msgServiceRouter, &codec)...,
append(extraOutputs, &appBuilder, &codec)...,
); err != nil {
return nil, fmt.Errorf("failed to inject dependencies: %w", err)
}
app := appBuilder.Build(log.NewNopLogger(), dbm.NewMemDB(), nil, msgServiceRouter)
app := appBuilder.Build(log.NewNopLogger(), dbm.NewMemDB(), nil)
if err := app.Load(true); err != nil {
return nil, fmt.Errorf("failed to load app: %w", err)
}