Verify write transactions in E2E tests (#22)
- Verify transaction inclusion and response code for write txs as done in cosmos-sdk E2E tests Reviewed-on: deep-stack/laconic2d#22 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
parent
08a29c023c
commit
946e64d289
@ -15,6 +15,7 @@ import (
|
|||||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
|
laconictestcli "git.vdb.to/cerc-io/laconic2d/testutil/cli"
|
||||||
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
||||||
types "git.vdb.to/cerc-io/laconic2d/x/auction"
|
types "git.vdb.to/cerc-io/laconic2d/x/auction"
|
||||||
"git.vdb.to/cerc-io/laconic2d/x/auction/client/cli"
|
"git.vdb.to/cerc-io/laconic2d/x/auction/client/cli"
|
||||||
@ -74,7 +75,7 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
|
||||||
newAddr, _ := info.GetAddress()
|
newAddr, _ := info.GetAddress()
|
||||||
_, err = clitestutil.MsgSendExec(
|
out, err := clitestutil.MsgSendExec(
|
||||||
val.ClientCtx,
|
val.ClientCtx,
|
||||||
val.Address,
|
val.Address,
|
||||||
newAddr,
|
newAddr,
|
||||||
@ -87,11 +88,12 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
||||||
)
|
)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
*accountAddress = newAddr.String()
|
|
||||||
|
|
||||||
// wait for tx to take effect
|
var response sdk.TxResponse
|
||||||
err = ets.network.WaitForNextBlock()
|
sr.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String())
|
||||||
sr.NoError(err)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, response.TxHash, 0))
|
||||||
|
|
||||||
|
*accountAddress = newAddr.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) string {
|
func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) string {
|
||||||
@ -109,9 +111,7 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
|
|||||||
|
|
||||||
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(resp.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, resp.TxHash, 0))
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag)
|
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
@ -127,7 +127,7 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
|
|||||||
bidArgs := []string{auctionId, fmt.Sprintf("200%s", ets.cfg.BondDenom)}
|
bidArgs := []string{auctionId, fmt.Sprintf("200%s", ets.cfg.BondDenom)}
|
||||||
resp, err := ets.executeTx(cli.GetCmdCommitBid(), bidArgs, bidderAccount)
|
resp, err := ets.executeTx(cli.GetCmdCommitBid(), bidArgs, bidderAccount)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(resp.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, resp.TxHash, 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
return auctionId
|
return auctionId
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
laconictestcli "git.vdb.to/cerc-io/laconic2d/testutil/cli"
|
||||||
auctiontypes "git.vdb.to/cerc-io/laconic2d/x/auction"
|
auctiontypes "git.vdb.to/cerc-io/laconic2d/x/auction"
|
||||||
"git.vdb.to/cerc-io/laconic2d/x/auction/client/cli"
|
"git.vdb.to/cerc-io/laconic2d/x/auction/client/cli"
|
||||||
)
|
)
|
||||||
@ -51,8 +52,9 @@ func (ets *E2ETestSuite) TestTxCommitBid() {
|
|||||||
fmt.Sprintf("100%s", ets.cfg.BondDenom),
|
fmt.Sprintf("100%s", ets.cfg.BondDenom),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, resp.TxHash, 0))
|
||||||
|
|
||||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(),
|
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(),
|
||||||
[]string{fmt.Sprintf("--%s=json", flags.FlagOutput)})
|
[]string{fmt.Sprintf("--%s=json", flags.FlagOutput)})
|
||||||
@ -67,7 +69,7 @@ func (ets *E2ETestSuite) TestTxCommitBid() {
|
|||||||
resp, err := ets.executeTx(cli.GetCmdCommitBid(), test.args, bidderAccount)
|
resp, err := ets.executeTx(cli.GetCmdCommitBid(), test.args, bidderAccount)
|
||||||
if test.createAuction {
|
if test.createAuction {
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(resp.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, resp.TxHash, 0))
|
||||||
} else {
|
} else {
|
||||||
sr.Error(err)
|
sr.Error(err)
|
||||||
}
|
}
|
||||||
@ -96,10 +98,5 @@ func (ets *E2ETestSuite) executeTx(cmd *cobra.Command, args []string, caller str
|
|||||||
return sdk.TxResponse{}, err
|
return sdk.TxResponse{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
if err != nil {
|
|
||||||
return sdk.TxResponse{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
|
laconictestcli "git.vdb.to/cerc-io/laconic2d/testutil/cli"
|
||||||
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
||||||
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
||||||
"git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
"git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
||||||
@ -62,7 +63,7 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
|
||||||
newAddr, _ := info.GetAddress()
|
newAddr, _ := info.GetAddress()
|
||||||
_, err = clitestutil.MsgSendExec(
|
out, err := clitestutil.MsgSendExec(
|
||||||
val.ClientCtx,
|
val.ClientCtx,
|
||||||
val.Address,
|
val.Address,
|
||||||
newAddr,
|
newAddr,
|
||||||
@ -75,11 +76,12 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
||||||
)
|
)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
*accountAddress = newAddr.String()
|
|
||||||
|
|
||||||
// wait for tx to take effect
|
var response sdk.TxResponse
|
||||||
err = ets.network.WaitForNextBlock()
|
sr.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String())
|
||||||
sr.NoError(err)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, response.TxHash, 0))
|
||||||
|
|
||||||
|
*accountAddress = newAddr.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) createBond() string {
|
func (ets *E2ETestSuite) createBond() string {
|
||||||
@ -96,14 +98,12 @@ func (ets *E2ETestSuite) createBond() string {
|
|||||||
}
|
}
|
||||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, createBondCmd, args)
|
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, createBondCmd, args)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
|
||||||
var d sdk.TxResponse
|
var d sdk.TxResponse
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.Zero(d.Code)
|
||||||
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
// wait for tx to take effect
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
// getting the bonds list and returning the bond-id
|
// getting the bonds list and returning the bond-id
|
||||||
clientCtx := val.ClientCtx
|
clientCtx := val.ClientCtx
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||||
"github.com/cosmos/cosmos-sdk/types/module/testutil"
|
"github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||||
|
|
||||||
laconicApp "git.vdb.to/cerc-io/laconic2d/app"
|
laconicApp "git.vdb.to/cerc-io/laconic2d/app"
|
||||||
@ -58,6 +59,7 @@ func NewTestNetworkFixture() network.TestFixture {
|
|||||||
GenesisState: app.DefaultGenesis(),
|
GenesisState: app.DefaultGenesis(),
|
||||||
EncodingConfig: testutil.MakeTestEncodingConfig(
|
EncodingConfig: testutil.MakeTestEncodingConfig(
|
||||||
auth.AppModuleBasic{},
|
auth.AppModuleBasic{},
|
||||||
|
bank.AppModuleBasic{},
|
||||||
staking.AppModuleBasic{},
|
staking.AppModuleBasic{},
|
||||||
auctionmodule.AppModule{},
|
auctionmodule.AppModule{},
|
||||||
bondmodule.AppModule{},
|
bondmodule.AppModule{},
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
|
laconictestcli "git.vdb.to/cerc-io/laconic2d/testutil/cli"
|
||||||
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
||||||
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond"
|
||||||
bondcli "git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
bondcli "git.vdb.to/cerc-io/laconic2d/x/bond/client/cli"
|
||||||
@ -81,7 +82,7 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
|
||||||
newAddr, _ := info.GetAddress()
|
newAddr, _ := info.GetAddress()
|
||||||
_, err = clitestutil.MsgSendExec(
|
out, err := clitestutil.MsgSendExec(
|
||||||
val.ClientCtx,
|
val.ClientCtx,
|
||||||
val.Address,
|
val.Address,
|
||||||
newAddr,
|
newAddr,
|
||||||
@ -94,11 +95,12 @@ func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAdd
|
|||||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(ets.cfg.BondDenom, math.NewInt(10))).String()),
|
||||||
)
|
)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
*accountAddress = newAddr.String()
|
|
||||||
|
|
||||||
// wait for tx to take effect
|
var response sdk.TxResponse
|
||||||
err = ets.network.WaitForNextBlock()
|
sr.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String())
|
||||||
sr.NoError(err)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, response.TxHash, 0))
|
||||||
|
|
||||||
|
*accountAddress = newAddr.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) createBond() string {
|
func (ets *E2ETestSuite) createBond() string {
|
||||||
@ -118,11 +120,7 @@ func (ets *E2ETestSuite) createBond() string {
|
|||||||
var d sdk.TxResponse
|
var d sdk.TxResponse
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
// wait for tx to take effect
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
// getting the bonds list and returning the bond-id
|
// getting the bonds list and returning the bond-id
|
||||||
clientCtx := val.ClientCtx
|
clientCtx := val.ClientCtx
|
||||||
@ -162,10 +160,7 @@ func (ets *E2ETestSuite) reserveName(authorityName string) {
|
|||||||
var d sdk.TxResponse
|
var d sdk.TxResponse
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) createNameRecord(authorityName string) {
|
func (ets *E2ETestSuite) createNameRecord(authorityName string) {
|
||||||
@ -189,10 +184,7 @@ func (ets *E2ETestSuite) createNameRecord(authorityName string) {
|
|||||||
var d sdk.TxResponse
|
var d sdk.TxResponse
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
// Get the bond-id
|
// Get the bond-id
|
||||||
bondId := ets.bondId
|
bondId := ets.bondId
|
||||||
@ -212,10 +204,7 @@ func (ets *E2ETestSuite) createNameRecord(authorityName string) {
|
|||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
args = []string{
|
args = []string{
|
||||||
fmt.Sprintf("lrn://%s/", authorityName),
|
fmt.Sprintf("lrn://%s/", authorityName),
|
||||||
@ -233,10 +222,7 @@ func (ets *E2ETestSuite) createNameRecord(authorityName string) {
|
|||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) createRecord(bondId string) {
|
func (ets *E2ETestSuite) createRecord(bondId string) {
|
||||||
@ -263,10 +249,7 @@ func (ets *E2ETestSuite) createRecord(bondId string) {
|
|||||||
var d sdk.TxResponse
|
var d sdk.TxResponse
|
||||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
sr.Zero(d.Code, d.RawLog)
|
sr.NoError(laconictestcli.CheckTxCode(ets.network, val.ClientCtx, d.TxHash, 0))
|
||||||
|
|
||||||
err = ets.network.WaitForNextBlock()
|
|
||||||
sr.NoError(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ets *E2ETestSuite) updateParams(params *registrytypes.Params) {
|
func (ets *E2ETestSuite) updateParams(params *registrytypes.Params) {
|
||||||
|
43
testutil/cli/tx.go
Normal file
43
testutil/cli/tx.go
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
|
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||||
|
|
||||||
|
"git.vdb.to/cerc-io/laconic2d/testutil/network"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.3/testutil/cli/tx.go#L15
|
||||||
|
|
||||||
|
// CheckTxCode verifies that the transaction result returns a specific code
|
||||||
|
// Takes a network, wait for two blocks and fetch the transaction from its hash
|
||||||
|
func CheckTxCode(network *network.Network, clientCtx client.Context, txHash string, expectedCode uint32) error {
|
||||||
|
// wait for 2 blocks
|
||||||
|
for i := 0; i < 2; i++ {
|
||||||
|
if err := network.WaitForNextBlock(); err != nil {
|
||||||
|
return fmt.Errorf("failed to wait for next block: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := authcli.QueryTxCmd()
|
||||||
|
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", flags.FlagOutput)})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var response sdk.TxResponse
|
||||||
|
if err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if response.Code != expectedCode {
|
||||||
|
return fmt.Errorf("expected code %d, got %d", expectedCode, response.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -68,5 +68,7 @@ package network
|
|||||||
/*
|
/*
|
||||||
NOTE:
|
NOTE:
|
||||||
Copied over from https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/testutil/network
|
Copied over from https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/testutil/network
|
||||||
Patch: Skipped network.LatestHeight() call at the end of New()
|
Patch:
|
||||||
|
- Skipped network.LatestHeight() call at the end of New()
|
||||||
|
- Removed block timeouts
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user