Skip to content

Commit

Permalink
replace simapp with IrisApp
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamer committed Mar 13, 2024
1 parent 65dccb0 commit aee2a7d
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 1,148 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ require (
)

require (
cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d
github.com/gogo/protobuf v1.3.2
github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4
github.com/pkg/errors v0.9.1
Expand All @@ -52,6 +51,7 @@ require (
require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d // indirect
cosmossdk.io/tools/rosetta v0.2.1 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
Expand Down
6 changes: 3 additions & 3 deletions modules/guardian/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
guardiancli "github.com/irisnet/irishub/v3/modules/guardian/client/cli"
guardiantestutil "github.com/irisnet/irishub/v3/modules/guardian/client/testutil"
guardiantypes "github.com/irisnet/irishub/v3/modules/guardian/types"
"github.com/irisnet/irishub/v3/simapp"
apptestutil "github.com/irisnet/irishub/v3/testutil"
)

var privKey cryptotypes.PrivKey
Expand All @@ -35,7 +35,7 @@ type IntegrationTestSuite struct {
func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")

cfg := simapp.NewConfig()
cfg := apptestutil.NewConfig()
cfg.NumValidators = 1

privKey, pubKey, addr = testdata.KeyTestPubAddr()
Expand Down Expand Up @@ -90,7 +90,7 @@ func (s *IntegrationTestSuite) TestGuardian() {
),
}

result := simapp.ExecTxCmdWithResult(s.T(), s.network, clientCtx, bankcli.NewSendTxCmd(), args)
result := apptestutil.ExecTxCmdWithResult(s.T(), s.network, clientCtx, bankcli.NewSendTxCmd(), args)
s.Require().Equal(uint32(0), result.TxResult.Code, result.TxResult.Log)

//------test GetCmdQuerySupers()-------------
Expand Down
10 changes: 6 additions & 4 deletions modules/guardian/client/testutil/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/network"

guardiancli "github.com/irisnet/irishub/v3/modules/guardian/client/cli"
"github.com/irisnet/irishub/v3/simapp"
apptestutil "github.com/irisnet/irishub/v3/testutil"
)

// MsgRedelegateExec creates a redelegate message.
// CreateSuperExec creates a new super
func CreateSuperExec(
t *testing.T,
network *network.Network,
Expand All @@ -30,9 +30,10 @@ func CreateSuperExec(
}
args = append(args, extraArgs...)

return simapp.ExecTxCmdWithResult(t, network, clientCtx, guardiancli.GetCmdCreateSuper(), args)
return apptestutil.ExecTxCmdWithResult(t, network, clientCtx, guardiancli.GetCmdCreateSuper(), args)
}

// DeleteSuperExec deletes a super
func DeleteSuperExec(
t *testing.T,
network *network.Network,
Expand All @@ -45,9 +46,10 @@ func DeleteSuperExec(
}
args = append(args, extraArgs...)

return simapp.ExecTxCmdWithResult(t, network, clientCtx, guardiancli.GetCmdDeleteSuper(), args)
return apptestutil.ExecTxCmdWithResult(t, network, clientCtx, guardiancli.GetCmdDeleteSuper(), args)
}

// QuerySupersExec queries supers
func QuerySupersExec(clientCtx client.Context, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
fmt.Sprintf("--%s=json", cli.OutputFlag),
Expand Down
4 changes: 2 additions & 2 deletions modules/guardian/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/irisnet/irishub/v3/modules/guardian"
"github.com/irisnet/irishub/v3/modules/guardian/keeper"
"github.com/irisnet/irishub/v3/modules/guardian/types"
"github.com/irisnet/irishub/v3/simapp"
"github.com/irisnet/irishub/v3/testutil"
)

type TestSuite struct {
Expand All @@ -25,7 +25,7 @@ type TestSuite struct {
}

func (suite *TestSuite) SetupTest() {
app := simapp.Setup(suite.T(), false)
app := testutil.Setup(suite.T(), false)

suite.cdc = codec.NewAminoCodec(app.LegacyAmino())
suite.ctx = app.BaseApp.NewContext(false, tmproto.Header{})
Expand Down
6 changes: 3 additions & 3 deletions modules/guardian/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/irisnet/irishub/v3/modules/guardian/keeper"
"github.com/irisnet/irishub/v3/modules/guardian/types"
"github.com/irisnet/irishub/v3/simapp"
"github.com/irisnet/irishub/v3/testutil"
)

var (
Expand All @@ -37,11 +37,11 @@ type KeeperTestSuite struct {
cdc *codec.LegacyAmino
ctx sdk.Context
keeper keeper.Keeper
app *simapp.SimApp
app *testutil.AppBuilder
}

func (suite *KeeperTestSuite) SetupTest() {
app := simapp.Setup(suite.T(), false)
app := testutil.Setup(suite.T(), false)

suite.app = app
suite.cdc = app.LegacyAmino()
Expand Down
6 changes: 3 additions & 3 deletions modules/mint/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/irisnet/irishub/v3/modules/mint"
"github.com/irisnet/irishub/v3/modules/mint/types"
"github.com/irisnet/irishub/v3/simapp"
apptestutil "github.com/irisnet/irishub/v3/testutil"
)

func TestBeginBlocker(t *testing.T) {
Expand All @@ -29,8 +29,8 @@ func TestBeginBlocker(t *testing.T) {
}

// returns context and an app with updated mint keeper
func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) {
app := simapp.Setup(t, false)
func createTestApp(t *testing.T, isCheckTx bool) (*apptestutil.AppBuilder, sdk.Context) {
app := apptestutil.Setup(t, false)

ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: 2})
app.MintKeeper.SetParams(ctx, types.NewParams(
Expand Down
4 changes: 2 additions & 2 deletions modules/mint/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

minttestutil "github.com/irisnet/irishub/v3/modules/mint/client/testutil"
minttypes "github.com/irisnet/irishub/v3/modules/mint/types"
"github.com/irisnet/irishub/v3/simapp"
"github.com/irisnet/irishub/v3/testutil"
)

type IntegrationTestSuite struct {
Expand All @@ -22,7 +22,7 @@ type IntegrationTestSuite struct {
func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")

cfg := simapp.NewConfig()
cfg := testutil.NewConfig()
cfg.NumValidators = 1

var err error
Expand Down
2 changes: 1 addition & 1 deletion modules/mint/client/rest/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package rest_test
// "github.com/cosmos/cosmos-sdk/types/rest"

// minttypes "github.com/irisnet/irishub/v3/modules/mint/types"
// "github.com/irisnet/irishub/v3/simapp"
// "github.com/irisnet/irishub/v3/testutil"
// )

// type IntegrationTestSuite struct {
Expand Down
6 changes: 3 additions & 3 deletions modules/mint/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/irisnet/irishub/v3/modules/mint/types"
"github.com/irisnet/irishub/v3/simapp"
apptestutil "github.com/irisnet/irishub/v3/testutil"
)

type KeeperTestSuite struct {
suite.Suite

cdc *codec.LegacyAmino
ctx sdk.Context
app *simapp.SimApp
app *apptestutil.AppBuilder
}

func (suite *KeeperTestSuite) SetupTest() {
app := simapp.Setup(suite.T(), false)
app := apptestutil.Setup(suite.T(), false)

suite.cdc = app.LegacyAmino()
suite.ctx = app.BaseApp.NewContext(false, tmproto.Header{})
Expand Down
9 changes: 5 additions & 4 deletions modules/mint/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import (
"github.com/stretchr/testify/require"

sdkmath "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/types/kv"

"github.com/irisnet/irishub/v3/modules/mint/simulation"
"github.com/irisnet/irishub/v3/modules/mint/types"
"github.com/irisnet/irishub/v3/simapp"
"github.com/irisnet/irishub/v3/testutil"
)

func TestDecodeStore(t *testing.T) {
minter := types.NewMinter(time.Now().UTC(), sdkmath.NewIntWithDecimal(2, 9))
cdc, _ := simapp.MakeCodecs()
dec := simulation.NewDecodeStore(cdc)
ec := testutil.MakeCodecs()
dec := simulation.NewDecodeStore(ec.Marshaler)

kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{Key: types.MinterKey, Value: cdc.MustMarshal(&minter)},
{Key: types.MinterKey, Value: ec.Marshaler.MustMarshal(&minter)},
{Key: []byte{0x99}, Value: []byte{0x99}},
},
}
Expand Down
Loading

0 comments on commit aee2a7d

Please sign in to comment.