-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
503 additions
and
38 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
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
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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
"context" | ||
"testing" | ||
|
||
"github.com/strangelove-ventures/ibctest/ibc" | ||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/cosmos/ibc-go/v4/e2e/testsuite" | ||
) | ||
|
||
func TestFeeMiddlewareTestSuite(t *testing.T) { | ||
suite.Run(t, new(FeeMiddlewareTestSuite)) | ||
} | ||
|
||
type FeeMiddlewareTestSuite struct { | ||
suite.Suite | ||
testsuite.E2ETestSuite | ||
} | ||
|
||
func (s *FeeMiddlewareTestSuite) TestPlaceholder() { | ||
tag, ok := os.LookupEnv("SIMD_TAG") | ||
s.Require().True(ok) | ||
s.T().Logf("SIMD_TAG=%s", tag) | ||
ctx := context.Background() | ||
r := s.SetupChainsRelayerAndChannel(ctx, feeMiddlewareChannelOptions()) | ||
s.T().Run("start relayer", func(t *testing.T) { | ||
s.StartRelayer(r) | ||
}) | ||
|
||
image, ok := os.LookupEnv("SIMD_IMAGE") | ||
s.Require().True(ok) | ||
s.T().Logf("SIMD_IMAGE=%s", image) | ||
} | ||
|
||
s.T().Logf("Placeholder test") | ||
s.Require().True(true) | ||
// feeMiddlewareChannelOptions configures both of the chains to have fee middleware enabled. | ||
func feeMiddlewareChannelOptions() func(options *ibc.CreateChannelOptions) { | ||
return func(opts *ibc.CreateChannelOptions) { | ||
opts.Version = "{\"fee_version\":\"ics29-1\",\"app_version\":\"ics20-1\"}" | ||
opts.DestPortName = "transfer" | ||
opts.SourcePortName = "transfer" | ||
} | ||
} |
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,83 @@ | ||
package testconfig | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/strangelove-ventures/ibctest/ibc" | ||
) | ||
|
||
const ( | ||
DefaultSimdImage = "ghcr.io/cosmos/ibc-go-simd-e2e" | ||
SimdImageEnv = "SIMD_IMAGE" | ||
SimdTagEnv = "SIMD_TAG" | ||
) | ||
|
||
// TestConfig holds various fields used in the E2E tests. | ||
type TestConfig struct { | ||
SimdImage string | ||
SimdTag string | ||
} | ||
|
||
// FromEnv returns a TestConfig constructed from environment variables. | ||
func FromEnv() TestConfig { | ||
simdImage, ok := os.LookupEnv(SimdImageEnv) | ||
if !ok { | ||
simdImage = DefaultSimdImage | ||
} | ||
|
||
simdTag, ok := os.LookupEnv(SimdTagEnv) | ||
if !ok { | ||
panic(fmt.Sprintf("must specify simd version for test with environment variable [%s]", SimdTagEnv)) | ||
} | ||
|
||
return TestConfig{ | ||
SimdImage: simdImage, | ||
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, | ||
} | ||
} |
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,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, home string) ibc.Relayer { | ||
return ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.CustomDockerImage(cosmosRelayerRepository, "main")).Build( | ||
t, dockerClient, network, home, | ||
) | ||
} |
Oops, something went wrong.