Skip to content

Commit

Permalink
attempt at fixing the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Feb 22, 2023
1 parent e717357 commit 5c17118
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions tests/e2e/tx/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/suite"

"cosmossdk.io/simapp"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -37,6 +36,10 @@ import (

var bankMsgSendEventAction = fmt.Sprintf("message.action='%s'", sdk.MsgTypeURL(&banktypes.MsgSend{}))

func TestE2ETestSuite(t *testing.T) {
suite.Run(t, new(E2ETestSuite))
}

type E2ETestSuite struct {
suite.Suite

Expand Down Expand Up @@ -101,10 +104,9 @@ func (s *E2ETestSuite) SetupSuite() {
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &tr))
s.Require().Equal(uint32(0), tr.Code)

s.Require().NoError(s.network.WaitForNextBlock())
height, err := s.network.LatestHeight()
resp, err := cli.GetTxResponse(s.network, val.ClientCtx, tr.TxHash)
s.Require().NoError(err)
s.txHeight = height
s.txHeight = resp.Height
}

func (s *E2ETestSuite) TearDownSuite() {
Expand All @@ -121,7 +123,6 @@ func (s *E2ETestSuite) TestQueryBySig() {
s.Require().NoError(err)
s.Require().NotEmpty(resp.TxResponse.TxHash)

s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(s.network.WaitForNextBlock())

// get the signature out of the builder
Expand Down Expand Up @@ -340,7 +341,6 @@ func (s E2ETestSuite) TestGetTxEvents_GRPC() {
for _, tc := range testCases {
s.Run(tc.name, func() {
// Query the tx via gRPC.
s.Require().NoError(s.network.WaitForNextBlock())
grpcRes, err := s.queryClient.GetTxsEvent(context.Background(), tc.req)
if tc.expErr {
s.Require().Error(err)
Expand Down Expand Up @@ -1106,10 +1106,6 @@ func (s E2ETestSuite) TestTxDecodeAmino_GRPCGateway() {
}
}

func TestE2ETestSuite(t *testing.T) {
suite.Run(t, new(E2ETestSuite))
}

func (s E2ETestSuite) mkTxBuilder() client.TxBuilder {
val := s.network.Validators[0]
s.Require().NoError(s.network.WaitForNextBlock())
Expand Down
2 changes: 1 addition & 1 deletion testutil/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func CheckTxCode(network *network.Network, clientCtx client.Context, txHash stri
// Takes a network, wait for two blocks and fetch the transaction from its hash
func GetTxResponse(network *network.Network, clientCtx client.Context, txHash string) (sdk.TxResponse, error) {
// wait for 2 blocks
for i := 0; i < 2; i++ {
for i := 0; i < 3; i++ {
if err := network.WaitForNextBlock(); err != nil {
return sdk.TxResponse{}, fmt.Errorf("failed to wait for next block: %w", err)
}
Expand Down

0 comments on commit 5c17118

Please sign in to comment.