Make integration test suites reusable by apps (#6711)
* WIP on refactoring new integration tests.
* godocs
* godocs
* Fix ineff assign
* Updates
* Updates
* fix test
* refactor crisis, distr testsuites
* fix import issue
* refactor x/auth
* refactor x/authz
* refactor x/evidence
* refactor x/feegrant
* refactor x/genutil
* refactor x/gov
* refactor x/mint
* refactor x/params
* refactor x/{auth_vesting, slashing, staking}
* fix lint
* fix tests & lint
* fix lint
* fix tests
* lint
* lint
* fix lint memory
* add missing `norace` build flag
* update feegrant cfg
* fix lint
Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
This commit is contained in:
co-authored by
atheesh
atheeshp
parent
5ea817a6fb
commit
3c65c3dacd
@@ -0,0 +1,17 @@
|
||||
// +build norace
|
||||
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg.NumValidators = 1
|
||||
suite.Run(t, NewIntegrationTestSuite(cfg))
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
// +build norace
|
||||
|
||||
package cli_test
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
testnet "github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/mint/client/cli"
|
||||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
||||
@@ -21,32 +18,33 @@ import (
|
||||
type IntegrationTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg testnet.Config
|
||||
network *testnet.Network
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
}
|
||||
|
||||
func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
|
||||
return &IntegrationTestSuite{cfg: cfg}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
|
||||
cfg := testnet.DefaultConfig()
|
||||
genesisState := cfg.GenesisState
|
||||
cfg.NumValidators = 1
|
||||
genesisState := s.cfg.GenesisState
|
||||
|
||||
var mintData minttypes.GenesisState
|
||||
s.Require().NoError(cfg.Codec.UnmarshalJSON(genesisState[minttypes.ModuleName], &mintData))
|
||||
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[minttypes.ModuleName], &mintData))
|
||||
|
||||
inflation := sdk.MustNewDecFromStr("1.0")
|
||||
mintData.Minter.Inflation = inflation
|
||||
mintData.Params.InflationMin = inflation
|
||||
mintData.Params.InflationMax = inflation
|
||||
|
||||
mintDataBz, err := cfg.Codec.MarshalJSON(&mintData)
|
||||
mintDataBz, err := s.cfg.Codec.MarshalJSON(&mintData)
|
||||
s.Require().NoError(err)
|
||||
genesisState[minttypes.ModuleName] = mintDataBz
|
||||
cfg.GenesisState = genesisState
|
||||
s.cfg.GenesisState = genesisState
|
||||
|
||||
s.cfg = cfg
|
||||
s.network = testnet.New(s.T(), cfg)
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
|
||||
_, err = s.network.WaitForHeight(1)
|
||||
s.Require().NoError(err)
|
||||
@@ -163,7 +161,3 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(IntegrationTestSuite))
|
||||
}
|
||||
Reference in New Issue
Block a user