Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adapt upgrade e2e workflow for custom images #2541

Merged
merged 7 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a pr for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backporting the default upgrade handler here: #2551 #2552

- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be v6.0.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is referring to the icad docker image version, which includes ibc-go/v6-alpha1

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