-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bump ibctest version and ibc-go version to v6 for e2e module (#…
…2479) ## Description closes: #XXXX --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing) - [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes (cherry picked from commit 4bd05c6) # Conflicts: # e2e/go.mod # e2e/go.sum # e2e/testconfig/testconfig.go # e2e/tests/core/client_test.go # e2e/tests/interchain_accounts/base_test.go # e2e/tests/interchain_accounts/incentivized_test.go # e2e/tests/transfer/base_test.go # e2e/tests/transfer/incentivized_test.go # e2e/tests/upgrades/upgrade_test.go # e2e/testsuite/grpc_query.go # e2e/testsuite/relayer.go # e2e/testsuite/testsuite.go
- Loading branch information
1 parent
f0928ba
commit 1528713
Showing
13 changed files
with
2,775 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
"github.com/strangelove-ventures/ibctest/v6/ibc" | ||
"github.com/strangelove-ventures/ibctest/v6/test" | ||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/cosmos/ibc-go/e2e/testsuite" | ||
"github.com/cosmos/ibc-go/e2e/testvalues" | ||
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" | ||
ibcexported "github.com/cosmos/ibc-go/v6/modules/core/exported" | ||
ibctesting "github.com/cosmos/ibc-go/v6/testing" | ||
) | ||
|
||
func TestClientTestSuite(t *testing.T) { | ||
suite.Run(t, new(ClientTestSuite)) | ||
} | ||
|
||
type ClientTestSuite struct { | ||
testsuite.E2ETestSuite | ||
} | ||
|
||
// Status queries the current status of the client | ||
func (s *ClientTestSuite) Status(ctx context.Context, chain ibc.Chain, clientID string) (string, error) { | ||
queryClient := s.GetChainGRCPClients(chain).ClientQueryClient | ||
res, err := queryClient.ClientStatus(ctx, &clienttypes.QueryClientStatusRequest{ | ||
ClientId: clientID, | ||
}) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return res.Status, nil | ||
} | ||
|
||
func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() { | ||
t := s.T() | ||
ctx := context.TODO() | ||
|
||
var ( | ||
pathName string | ||
relayer ibc.Relayer | ||
subjectClientID string | ||
substituteClientID string | ||
badTrustingPeriod = time.Duration(time.Second) | ||
) | ||
|
||
t.Run("create substitute client with correct trusting period", func(t *testing.T) { | ||
relayer, _ = s.SetupChainsRelayerAndChannel(ctx) | ||
|
||
// TODO: update when client identifier created is accessible | ||
// currently assumes first client is 07-tendermint-0 | ||
substituteClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 0) | ||
|
||
// TODO: replace with better handling of path names | ||
pathName = fmt.Sprintf("%s-path-%d", s.T().Name(), 0) | ||
pathName = strings.ReplaceAll(pathName, "/", "-") | ||
}) | ||
|
||
chainA, chainB := s.GetChains() | ||
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) | ||
|
||
t.Run("create subject client with bad trusting period", func(t *testing.T) { | ||
createClientOptions := ibc.CreateClientOptions{ | ||
TrustingPeriod: badTrustingPeriod.String(), | ||
} | ||
|
||
s.SetupClients(ctx, relayer, createClientOptions) | ||
|
||
// TODO: update when client identifier created is accessible | ||
// currently assumes second client is 07-tendermint-1 | ||
subjectClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 1) | ||
}) | ||
|
||
time.Sleep(badTrustingPeriod) | ||
|
||
t.Run("update substitute client", func(t *testing.T) { | ||
s.UpdateClients(ctx, relayer, pathName) | ||
}) | ||
|
||
s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks") | ||
|
||
t.Run("check status of each client", func(t *testing.T) { | ||
t.Run("substitute should be active", func(t *testing.T) { | ||
status, err := s.Status(ctx, chainA, substituteClientID) | ||
s.Require().NoError(err) | ||
s.Require().Equal(ibcexported.Active.String(), status) | ||
}) | ||
|
||
t.Run("subject should be expired", func(t *testing.T) { | ||
status, err := s.Status(ctx, chainA, subjectClientID) | ||
s.Require().NoError(err) | ||
s.Require().Equal(ibcexported.Expired.String(), status) | ||
}) | ||
}) | ||
|
||
t.Run("pass client update proposal", func(t *testing.T) { | ||
proposal := clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subjectClientID, substituteClientID) | ||
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal) | ||
}) | ||
|
||
t.Run("check status of each client", func(t *testing.T) { | ||
t.Run("substitute should be active", func(t *testing.T) { | ||
status, err := s.Status(ctx, chainA, substituteClientID) | ||
s.Require().NoError(err) | ||
s.Require().Equal(ibcexported.Active.String(), status) | ||
}) | ||
|
||
t.Run("subject should be active", func(t *testing.T) { | ||
status, err := s.Status(ctx, chainA, subjectClientID) | ||
s.Require().NoError(err) | ||
s.Require().Equal(ibcexported.Active.String(), status) | ||
}) | ||
}) | ||
} |
Oops, something went wrong.