From 17922ebfbc55c6c08861d2ef8a4a864f2f3c1848 Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 31 Aug 2023 15:29:42 +0100 Subject: [PATCH 1/5] chore: allow specifying of relayer image --- e2e/relayer/relayer.go | 22 ++++++++++++++++------ e2e/testsuite/testconfig.go | 7 +++++++ e2e/testsuite/testsuite.go | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/e2e/relayer/relayer.go b/e2e/relayer/relayer.go index 0b0d1421dab..f1dbfce193b 100644 --- a/e2e/relayer/relayer.go +++ b/e2e/relayer/relayer.go @@ -36,9 +36,9 @@ func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclien t.Helper() switch cfg.Type { case Rly: - return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network) + return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image) case Hermes: - return newHermesRelayer(t, cfg.Tag, logger, dockerClient, network) + return newHermesRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image) default: panic(fmt.Sprintf("unknown relayer specified: %s", cfg.Type)) } @@ -46,8 +46,13 @@ func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclien // newCosmosRelayer returns an instance of the go relayer. // Options are used to allow for relayer version selection and specifying the default processing option. -func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer { +func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer { t.Helper() + + if relayerImage == "" { + relayerImage = rlyRelayerRepository + } + customImageOption := relayer.CustomDockerImage(rlyRelayerRepository, tag, rlyRelayerUser) relayerProcessingOption := relayer.StartupFlags("-p", "events") // relayer processes via events @@ -59,9 +64,14 @@ func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient } // newHermesRelayer returns an instance of the hermes relayer. -func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer { +func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer { t.Helper() - customImageOption := relayer.CustomDockerImage(hermesRelayerRepository, tag, hermesRelayerUser) + + if relayerImage == "" { + relayerImage = hermesRelayerRepository + } + + customImageOption := relayer.CustomDockerImage(relayerImage, tag, hermesRelayerUser) relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, logger, customImageOption) return relayerFactory.Build( @@ -69,7 +79,7 @@ func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient ) } -// RelayerMap is a mapping from test names to a relayer set for that test. +// Map is a mapping from test names to a relayer set for that test. type Map map[string]map[ibc.Wallet]bool // AddRelayer adds the given relayer to the relayer set for the given test name. diff --git a/e2e/testsuite/testconfig.go b/e2e/testsuite/testconfig.go index 6cdca97e33a..56f9332ad33 100644 --- a/e2e/testsuite/testconfig.go +++ b/e2e/testsuite/testconfig.go @@ -37,6 +37,9 @@ const ( ChainBTagEnv = "CHAIN_B_TAG" // RelayerTagEnv specifies the relayer version. Defaults to "main" RelayerTagEnv = "RELAYER_TAG" + // RelayerImageEnv specifies the image that the relayer will use. If left unspecified, it will default + // to values set for hermesRelayerRepository or rlyRelayerRepository. + RelayerImageEnv = "RELAYER_IMAGE" // RelayerTypeEnv specifies the type of relayer that should be used. RelayerTypeEnv = "RELAYER_TYPE" // ChainBinaryEnv binary is the binary that will be used for both chains. @@ -206,6 +209,10 @@ func applyEnvironmentVariableOverrides(fromFile TestConfig) TestConfig { fromFile.RelayerConfig.Type = envTc.RelayerConfig.Type } + if os.Getenv(RelayerImageEnv) != "" { + fromFile.RelayerConfig.Image = envTc.RelayerConfig.Image + } + if os.Getenv(ChainUpgradePlanEnv) != "" { fromFile.UpgradeConfig.PlanName = envTc.UpgradeConfig.PlanName } diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index b158d002977..b5cd5fb664c 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -88,6 +88,7 @@ func (s *E2ETestSuite) GetRelayerUsers(ctx context.Context, chainOpts ...ChainOp func (s *E2ETestSuite) SetupChainsRelayerAndChannel(ctx context.Context, channelOpts ...func(*ibc.CreateChannelOptions)) (ibc.Relayer, ibc.ChannelOutput) { chainA, chainB := s.GetChains() + r := relayer.New(s.T(), LoadConfig().RelayerConfig, s.logger, s.DockerClient, s.network) pathName := s.generatePathName() From 370b558669158e915c27d22d6944e012401ce641 Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 31 Aug 2023 15:34:15 +0100 Subject: [PATCH 2/5] chore: updating sample config file --- e2e/sample.config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/sample.config.yaml b/e2e/sample.config.yaml index 250738a27ac..8bf1e064fad 100644 --- a/e2e/sample.config.yaml +++ b/e2e/sample.config.yaml @@ -22,7 +22,7 @@ chains: relayer: type: rly # override with RELAYER_TYPE - image: ghcr.io/cosmos/relayer + image: ghcr.io/cosmos/relayer # override with RELAYER_IMAGE tag: latest # override with RELAYER_TAG cometbft: From 03405612a841797402709cdaef67ad61c44d578f Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 31 Aug 2023 15:38:11 +0100 Subject: [PATCH 3/5] chore: undid whitespace change --- e2e/testsuite/testsuite.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index b5cd5fb664c..9bf78ace602 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -87,8 +87,7 @@ func (s *E2ETestSuite) GetRelayerUsers(ctx context.Context, chainOpts ...ChainOp // This should be called at the start of every test, unless fine grained control is required. func (s *E2ETestSuite) SetupChainsRelayerAndChannel(ctx context.Context, channelOpts ...func(*ibc.CreateChannelOptions)) (ibc.Relayer, ibc.ChannelOutput) { chainA, chainB := s.GetChains() - - + r := relayer.New(s.T(), LoadConfig().RelayerConfig, s.logger, s.DockerClient, s.network) pathName := s.generatePathName() From 4fdf5e92a49eab53ae01fd8338fc308c6336720c Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 31 Aug 2023 15:38:41 +0100 Subject: [PATCH 4/5] chore: remove whitespace --- e2e/testsuite/testsuite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 9bf78ace602..b158d002977 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -87,7 +87,7 @@ func (s *E2ETestSuite) GetRelayerUsers(ctx context.Context, chainOpts ...ChainOp // This should be called at the start of every test, unless fine grained control is required. func (s *E2ETestSuite) SetupChainsRelayerAndChannel(ctx context.Context, channelOpts ...func(*ibc.CreateChannelOptions)) (ibc.Relayer, ibc.ChannelOutput) { chainA, chainB := s.GetChains() - + r := relayer.New(s.T(), LoadConfig().RelayerConfig, s.logger, s.DockerClient, s.network) pathName := s.generatePathName() From d53d72c0612da91c9a1bbf9ee55a53310c2856e5 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Fri, 1 Sep 2023 09:28:44 +0200 Subject: [PATCH 5/5] Update e2e/relayer/relayer.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- e2e/relayer/relayer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/relayer/relayer.go b/e2e/relayer/relayer.go index f1dbfce193b..7812180443a 100644 --- a/e2e/relayer/relayer.go +++ b/e2e/relayer/relayer.go @@ -53,7 +53,7 @@ func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient relayerImage = rlyRelayerRepository } - customImageOption := relayer.CustomDockerImage(rlyRelayerRepository, tag, rlyRelayerUser) + customImageOption := relayer.CustomDockerImage(relayerImage, tag, rlyRelayerUser) relayerProcessingOption := relayer.StartupFlags("-p", "events") // relayer processes via events relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, customImageOption, relayerProcessingOption)