Skip to content

Commit

Permalink
chore: adapt upgrade e2e workflow for custom images (#2541)
Browse files Browse the repository at this point in the history
* 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 7701999.

* replace v5 tag in upgrade e2e

* updating image tags
  • Loading branch information
damiannolan authored Oct 14, 2022
1 parent 0b2f5f2 commit 3674885
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Tests / E2E Upgrade
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
on: workflow_dispatch

jobs:
upgrade-tests:
Expand All @@ -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
Expand All @@ -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 }}
11 changes: 10 additions & 1 deletion e2e/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -49,6 +51,7 @@ type TestConfig struct {
ChainAConfig ChainConfig
ChainBConfig ChainConfig
RlyTag string
UpgradeTag string
}

type ChainConfig struct {
Expand Down Expand Up @@ -86,6 +89,11 @@ func FromEnv() TestConfig {
}
chainBImage := chainAImage

upgradeTag, ok := os.LookupEnv(ChainUpgradeTagEnv)
if !ok {
upgradeTag = ""
}

return TestConfig{
ChainAConfig: ChainConfig{
Image: chainAImage,
Expand All @@ -97,7 +105,8 @@ func FromEnv() TestConfig {
Tag: chainBTag,
Binary: chainBinary,
},
RlyTag: rlyTag,
RlyTag: rlyTag,
UpgradeTag: upgradeTag,
}
}

Expand Down
24 changes: 5 additions & 19 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package upgrades
import (
"context"
"fmt"
"os"
"testing"
"time"

Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3674885

Please sign in to comment.