Skip to content

Commit

Permalink
chore: adding environment variable to specify go relayer image (#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Jul 19, 2022
1 parent c809ce3 commit 5b61a5b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
with:
go-version: 1.18
- name: Run e2e Test
env:
# see images here https://github.com/cosmos/relayer/pkgs/container/relayer/versions
RLY_TAG: "v2.0.0-rc2"
run: |
cd e2e
make e2e-test suite=${{ matrix.suite }} test=${{ matrix.test }}
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
env:
SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }}
SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e
# see images here https://github.com/cosmos/relayer/pkgs/container/relayer/versions
RLY_TAG: "v2.0.0-rc2"
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
Expand Down
10 changes: 10 additions & 0 deletions e2e/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ const (
DefaultSimdImage = "ghcr.io/cosmos/ibc-go-simd-e2e"
SimdImageEnv = "SIMD_IMAGE"
SimdTagEnv = "SIMD_TAG"
GoRelayerTag = "RLY_TAG"

defaultRlyTag = "main"
)

// TestConfig holds various fields used in the E2E tests.
type TestConfig struct {
SimdImage string
SimdTag string
RlyTag string
}

// FromEnv returns a TestConfig constructed from environment variables.
Expand All @@ -31,9 +35,15 @@ func FromEnv() TestConfig {
panic(fmt.Sprintf("must specify simd version for test with environment variable [%s]", SimdTagEnv))
}

rlyTag, ok := os.LookupEnv(GoRelayerTag)
if !ok {
rlyTag = defaultRlyTag
}

return TestConfig{
SimdImage: simdImage,
SimdTag: simdTag,
RlyTag: rlyTag,
}
}

Expand Down
6 changes: 4 additions & 2 deletions e2e/testsuite/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package testsuite
import (
"testing"

"e2e/testconfig"

dockerclient "github.com/docker/docker/client"
"github.com/strangelove-ventures/ibctest"
"github.com/strangelove-ventures/ibctest/ibc"
Expand All @@ -15,8 +17,8 @@ const (
)

// 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(
func newCosmosRelayer(t *testing.T, tc testconfig.TestConfig, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
return ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.CustomDockerImage(cosmosRelayerRepository, tc.RlyTag)).Build(
t, dockerClient, network,
)
}
2 changes: 1 addition & 1 deletion e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *E2ETestSuite) SetupChainsRelayerAndChannel(ctx context.Context, channel
home, err := ioutil.TempDir("", "")
s.Require().NoError(err)

r := newCosmosRelayer(s.T(), s.logger, s.DockerClient, s.network)
r := newCosmosRelayer(s.T(), testconfig.FromEnv(), s.logger, s.DockerClient, s.network)

pathName := fmt.Sprintf("%s-path", s.T().Name())
pathName = strings.ReplaceAll(pathName, "/", "-")
Expand Down

0 comments on commit 5b61a5b

Please sign in to comment.