Skip to content

Commit

Permalink
imp(e2e): added more assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Jun 9, 2024
1 parent 062c61b commit 9f61a95
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
3 changes: 0 additions & 3 deletions e2e/interchaintestv8/e2esuite/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ func (s *TestSuite) QuerySignedHeader(
return nil, err
}

s.T().Logf("stdout: %s", stdout)

// TODO: Set trusted validators, trusted height
result := &ibctm.Header{}
err = chain.Config().EncodingConfig.Codec.UnmarshalJSON(stdout, result)
if err != nil {
Expand Down
31 changes: 31 additions & 0 deletions e2e/interchaintestv8/ics07tendermint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v8/testing"

Expand Down Expand Up @@ -106,6 +107,21 @@ func (s *ICS07TendermintTestSuite) TestInstantiate() {
ctx := context.Background()

s.SetupSuite(ctx)

s.Require().True(s.Run("VerifyClientStatus", func() {
statusResp, err := s.tendermintContract.QueryClient().Status(ctx, &ics07tendermint.QueryMsg_Status{})
s.Require().NoError(err)
s.Require().Equal(statusResp.Status, ibcexported.Active.String())

// if the height isn't present in the client state, this query would failed
_, err = s.tendermintContract.QueryClient().TimestampAtHeight(ctx, &ics07tendermint.QueryMsg_TimestampAtHeight{
Height: ics07tendermint.Height{
RevisionNumber: int(s.trustedHeight.RevisionNumber),
RevisionHeight: int(s.trustedHeight.RevisionHeight),
},
})
s.Require().NoError(err)
}))
}

// TestUpdateClient is a test that demonstrates updating the ICS-07 Tendermint client.
Expand All @@ -117,6 +133,21 @@ func (s *ICS07TendermintTestSuite) TestUpdateClient() {
_, wasmd2 := s.ChainA, s.ChainB

s.UpdateClientContract(ctx, s.tendermintContract, wasmd2)

s.Require().True(s.Run("VerifyClientStatus", func() {
statusResp, err := s.tendermintContract.QueryClient().Status(ctx, &ics07tendermint.QueryMsg_Status{})
s.Require().NoError(err)
s.Require().Equal(statusResp.Status, ibcexported.Active.String())

// if the height isn't present in the client state, this query would failed
_, err = s.tendermintContract.QueryClient().TimestampAtHeight(ctx, &ics07tendermint.QueryMsg_TimestampAtHeight{
Height: ics07tendermint.Height{
RevisionNumber: int(s.trustedHeight.RevisionNumber),
RevisionHeight: int(s.trustedHeight.RevisionHeight),
},
})
s.Require().NoError(err)
}))
}

func (s *ICS07TendermintTestSuite) UpdateClientContract(ctx context.Context, tmContract *ics07tendermint.Contract, counterpartyChain *cosmos.CosmosChain) {
Expand Down

0 comments on commit 9f61a95

Please sign in to comment.