From 367488503288c2ff9a8d6223fc2c51f1b208f3fd Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 14 Oct 2022 18:20:11 +0200 Subject: [PATCH] chore: adapt upgrade e2e workflow for custom images (#2541) * e2e upgrade test workflows in progress * adding chain binary to workflow * adding upgrade to compatibility workflows * Revert "adding upgrade to compatibility workflows" This reverts commit 77019997ed71c9c73b0077ecee45e5c0739111f6. * replace v5 tag in upgrade e2e * updating image tags --- .github/workflows/e2e-upgrade.yaml | 20 ++++++++++++++++---- e2e/testconfig/testconfig.go | 11 ++++++++++- e2e/tests/upgrades/upgrade_test.go | 24 +++++------------------- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index a739ce1c4e7..edcb8f98a6a 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -1,8 +1,5 @@ name: Tests / E2E Upgrade -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' +on: workflow_dispatch jobs: upgrade-tests: @@ -12,7 +9,16 @@ jobs: matrix: include: - test: TestV4ToV5ChainUpgrade + chain-image: ghcr.io/cosmos/ibc-go-simd + chain-a-tag: v4.1.0 + chain-b-tag: v4.1.0 + chain-upgrade-tag: pr-2144 # TODO: backport default upgrade handler to release/v5.x.x - test: TestV5ToV6ChainUpgrade + chain-image: ghcr.io/cosmos/ibc-go-icad + chain-binary: icad + chain-a-tag: v0.3.5 + chain-b-tag: v0.3.5 + chain-upgrade-tag: v0.4.0 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 @@ -22,3 +28,9 @@ jobs: run: | cd e2e make e2e-test entrypoint=TestUpgradeTestSuite test=${{ matrix.test }} + env: + CHAIN_IMAGE: ${{ matrix.chain-image }} + CHAIN_BINARY: ${{ matrix.chain-binary }} + CHAIN_A_TAG: ${{ matrix.chain-a-tag }} + CHAIN_B_TAG: ${{ matrix.chain-b-tag }} + CHAIN_UPGRADE_TAG: ${{ matrix.chain-upgrade-tag }} diff --git a/e2e/testconfig/testconfig.go b/e2e/testconfig/testconfig.go index fdb0abdc88f..926d6dbb92f 100644 --- a/e2e/testconfig/testconfig.go +++ b/e2e/testconfig/testconfig.go @@ -31,6 +31,8 @@ const ( GoRelayerTagEnv = "RLY_TAG" // ChainBinaryEnv binary is the binary that will be used for both chains. ChainBinaryEnv = "CHAIN_BINARY" + // ChainUpgradeTagEnv specifies the upgrade version tag + ChainUpgradeTagEnv = "CHAIN_UPGRADE_TAG" // defaultBinary is the default binary that will be used by the chains. defaultBinary = "simd" // defaultRlyTag is the tag that will be used if no relayer tag is specified. @@ -49,6 +51,7 @@ type TestConfig struct { ChainAConfig ChainConfig ChainBConfig ChainConfig RlyTag string + UpgradeTag string } type ChainConfig struct { @@ -86,6 +89,11 @@ func FromEnv() TestConfig { } chainBImage := chainAImage + upgradeTag, ok := os.LookupEnv(ChainUpgradeTagEnv) + if !ok { + upgradeTag = "" + } + return TestConfig{ ChainAConfig: ChainConfig{ Image: chainAImage, @@ -97,7 +105,8 @@ func FromEnv() TestConfig { Tag: chainBTag, Binary: chainBinary, }, - RlyTag: rlyTag, + RlyTag: rlyTag, + UpgradeTag: upgradeTag, } } diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 5e5118e898e..1d10977a0ac 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -3,7 +3,6 @@ package upgrades import ( "context" "fmt" - "os" "testing" "time" @@ -24,12 +23,12 @@ import ( "github.com/cosmos/ibc-go/e2e/testvalues" icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v6/testing" + simappupgrades "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades" ) const ( haltHeight = uint64(100) blocksAfterUpgrade = uint64(10) - defaultUpgradeName = "normal upgrade" ) func TestUpgradeTestSuite(t *testing.T) { @@ -83,11 +82,7 @@ func (s *UpgradeTestSuite) UpgradeChain(ctx context.Context, chain *cosmos.Cosmo func (s *UpgradeTestSuite) TestV4ToV5ChainUpgrade() { t := s.T() - // TODO: temporarily hard code the version upgrades. - oldVersion := "v4.0.0" - targetVersion := "pr-2144" // v5 version with upgrade handler, replace with v5.0.0-rc3 when it is cut. - s.Require().NoError(os.Setenv(testconfig.ChainATagEnv, oldVersion)) - s.Require().NoError(os.Setenv(testconfig.ChainBTagEnv, oldVersion)) + testCfg := testconfig.FromEnv() ctx := context.Background() relayer, channelA := s.SetupChainsRelayerAndChannel(ctx) @@ -144,7 +139,7 @@ func (s *UpgradeTestSuite) TestV4ToV5ChainUpgrade() { s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA, chainB), "failed to wait for blocks") t.Run("upgrade chainA", func(t *testing.T) { - s.UpgradeChain(ctx, chainA, chainAUpgradeProposalWallet, defaultUpgradeName, oldVersion, targetVersion) + s.UpgradeChain(ctx, chainA, chainAUpgradeProposalWallet, simappupgrades.DefaultUpgradeName, testCfg.ChainAConfig.Tag, testCfg.UpgradeTag) }) t.Run("restart relayer", func(t *testing.T) { @@ -193,16 +188,7 @@ func (s *UpgradeTestSuite) TestV4ToV5ChainUpgrade() { func (s *UpgradeTestSuite) TestV5ToV6ChainUpgrade() { t := s.T() - - const ( - CurrentVersion = "v0.3.5" - UpgradeVersion = "v0.4.0" - ) - - s.Require().NoError(os.Setenv(testconfig.ChainImageEnv, "ghcr.io/cosmos/ibc-go-icad")) - s.Require().NoError(os.Setenv(testconfig.ChainBinaryEnv, "icad")) - s.Require().NoError(os.Setenv(testconfig.ChainATagEnv, CurrentVersion)) - s.Require().NoError(os.Setenv(testconfig.ChainBTagEnv, CurrentVersion)) + testCfg := testconfig.FromEnv() ctx := context.Background() relayer, _ := s.SetupChainsRelayerAndChannel(ctx) @@ -300,7 +286,7 @@ func (s *UpgradeTestSuite) TestV5ToV6ChainUpgrade() { s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA, chainB), "failed to wait for blocks") t.Run("upgrade chainA", func(t *testing.T) { - s.UpgradeChain(ctx, chainA, chainAUpgradeProposalWallet, v6upgrades.UpgradeName, CurrentVersion, UpgradeVersion) + s.UpgradeChain(ctx, chainA, chainAUpgradeProposalWallet, v6upgrades.UpgradeName, testCfg.ChainAConfig.Tag, testCfg.UpgradeTag) }) t.Run("restart relayer", func(t *testing.T) {