Skip to content

Commit

Permalink
chore: merge with #1710
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton committed Jul 15, 2022
1 parent 4b9fe9b commit 46c96bb
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 169 deletions.
7 changes: 4 additions & 3 deletions e2e/fee_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
"github.com/strangelove-ventures/ibctest/test"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/v4/e2e/testsuite"
"github.com/cosmos/ibc-go/v4/e2e/testvalues"
"e2e/testsuite"
"e2e/testvalues"

feetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
)
Expand Down Expand Up @@ -75,7 +76,7 @@ func (s *FeeMiddlewareTestSuite) TestMsgPayPacketFeeAsyncSingleSender() {
payPacketFeeTxResp sdk.TxResponse
)

relayer, channelA := s.CreateChainsRelayerAndChannel(ctx, feeMiddlewareChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, feeMiddlewareChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down
10 changes: 5 additions & 5 deletions e2e/go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
module github.com/cosmos/ibc-go/v4/e2e
module e2e

go 1.18

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

require (
github.com/cosmos/cosmos-sdk v0.45.6
github.com/cosmos/ibc-go/v4 v4.0.0-rc0
github.com/docker/docker v20.10.17+incompatible
github.com/strangelove-ventures/ibctest v0.0.0-20220708204853-50f4be39c3e9
github.com/strangelove-ventures/ibctest v0.0.0-20220713213153-930886d8db30
github.com/stretchr/testify v1.8.0
go.uber.org/zap v1.21.0
google.golang.org/grpc v1.47.0
)

require (
Expand All @@ -30,8 +27,10 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-sdk v0.45.6 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/iavl v0.17.3 // indirect
github.com/cosmos/ibc-go/v4 v4.0.0-rc0 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
Expand Down Expand Up @@ -125,6 +124,7 @@ require (
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ=
github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI=
github.com/strangelove-ventures/ibctest v0.0.0-20220708204853-50f4be39c3e9 h1:waDZgkN+i3WSeUmDwdMvrNOh3iemGlevWqnznE/PQ0k=
github.com/strangelove-ventures/ibctest v0.0.0-20220708204853-50f4be39c3e9/go.mod h1:aWBeEKU4lGfvJ9qO543zJbQGtB2fK2ffrJh6jbtowEM=
github.com/strangelove-ventures/ibctest v0.0.0-20220713213153-930886d8db30 h1:pMhrxU1tY220nxDu6t/gb0H30NG+WYiSJFS5OrcxLFs=
github.com/strangelove-ventures/ibctest v0.0.0-20220713213153-930886d8db30/go.mod h1:aWBeEKU4lGfvJ9qO543zJbQGtB2fK2ffrJh6jbtowEM=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
Expand Down
47 changes: 47 additions & 0 deletions e2e/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package testconfig
import (
"fmt"
"os"

"github.com/strangelove-ventures/ibctest/ibc"
)

const (
Expand Down Expand Up @@ -34,3 +36,48 @@ func FromEnv() TestConfig {
SimdTag: simdTag,
}
}

// ChainOptions stores chain configurations for the chains that will be
// created for the tests. They can be modified by passing ChainOptionConfiguration
// to E2ETestSuite.GetChains.
type ChainOptions struct {
ChainAConfig *ibc.ChainConfig
ChainBConfig *ibc.ChainConfig
}

// ChainOptionConfiguration enables arbitrary configuration of ChainOptions.
type ChainOptionConfiguration func(options *ChainOptions)

// DefaultChainOptions returns the default configuration for the chains.
// These options can be configured by passing configuration functions to E2ETestSuite.GetChains.
func DefaultChainOptions() ChainOptions {
tc := FromEnv()
chainACfg := newDefaultSimappConfig(tc, "simapp-a", "chain-a", "atoma")
chainBCfg := newDefaultSimappConfig(tc, "simapp-b", "chain-b", "atomb")
return ChainOptions{
ChainAConfig: &chainACfg,
ChainBConfig: &chainBCfg,
}
}

// newDefaultSimappConfig creates an ibc configuration for simd.
func newDefaultSimappConfig(tc TestConfig, name, chainID, denom string) ibc.ChainConfig {
return ibc.ChainConfig{
Type: "cosmos",
Name: name,
ChainID: chainID,
Images: []ibc.DockerImage{
{
Repository: tc.SimdImage,
Version: tc.SimdTag,
},
},
Bin: "simd",
Bech32Prefix: "cosmos",
Denom: denom,
GasPrices: fmt.Sprintf("0.01%s", denom),
GasAdjustment: 1.3,
TrustingPeriod: "508h",
NoHostMount: false,
}
}
22 changes: 22 additions & 0 deletions e2e/testsuite/relayer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package testsuite

import (
"testing"

dockerclient "github.com/docker/docker/client"
"github.com/strangelove-ventures/ibctest"
"github.com/strangelove-ventures/ibctest/ibc"
"github.com/strangelove-ventures/ibctest/relayer"
"go.uber.org/zap"
)

const (
cosmosRelayerRepository = "ghcr.io/cosmos/relayer"
)

// newCosmosRelayer returns an instance of the go relayer.
func newCosmosRelayer(t *testing.T, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
return ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.CustomDockerImage(cosmosRelayerRepository, "main")).Build(
t, dockerClient, network,
)
}
Loading

0 comments on commit 46c96bb

Please sign in to comment.