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

[WIP] Simplify E2E Configuration #7568

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .github/workflows/e2e-compatibility-workflow-call.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ jobs:
# Note: this is significant as the standard behaviour when running e2es on PRs
# is that there is a set of env vars that are the same for each run. e.g. the same docker image is used
# for every test. With compatibility tests, each test may be running different combinations of images.
CHAIN_IMAGE: 'ghcr.io/cosmos/ibc-go-simd'
CHAIN_A_TAG: '${{ matrix.chain-a }}'
CHAIN_B_TAG: '${{ matrix.chain-b }}'
CHAIN_BINARY: 'simd'
RELAYER_ID: '${{ matrix.relayer-type }}'
E2E_CONFIG_PATH: "e2e/ci-e2e-config.yaml"
- name: Upload Diagnostics
uses: actions/upload-artifact@v4
# we only want to upload logs on test failures.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
CHAIN_A_TAG: latest
CHAIN_B_TAG: latest
CHAIN_IMAGE: ibc-go-simd
RELAYER_ID: "hermes" # by default use hermes for fork e2es.
E2E_CONFIG_PATH: "e2e/ci-e2e-config.yaml"
FORK: "true"
# run this job on forks and copies of ibc-go, for example: a public fork or a private copy of ibc-go.
if: ${{ github.repository != 'cosmos/ibc-go' || github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
Expand Down
52 changes: 7 additions & 45 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ on:
required: false
type: string
default: '' # empty string means don't skip any test.
chain-image:
description: 'The image to use for chains'
required: true
type: string
default: 'ghcr.io/cosmos/ibc-go-simd'
chain-a-tag:
description: 'The tag to use for chain A'
required: true
Expand All @@ -36,11 +31,6 @@ on:
description: 'The tag to use for chain B'
required: true
type: string
chain-binary:
default: 'simd'
description: 'The chain binary'
required: false
type: string
chain-upgrade-tag:
default: ''
description: 'The image tag that the chain will be upgraded to'
Expand All @@ -52,21 +42,6 @@ on:
description: 'The upgrade plan name'
required: false
type: string
relayer-image:
description: 'The image to use for the relayer'
required: false
default: '' # the tests themselves will choose a sensible default when unset.
type: string
relayer-type:
description: 'The type of relayer to use'
required: false
default: 'hermes'
type: string
relayer-tag:
description: 'The tag to use for the relayer'
required: false
default: '' # the tests themselves will choose a sensible default when unset.
type: string
build-and-push-docker-image:
description: 'Flag to specify if the docker image should be built and pushed beforehand'
required: false
Expand All @@ -82,6 +57,11 @@ on:
required: false
type: boolean
default: false
e2e-config-path:
description: 'Specify relative or absolute path of config file for test'
required: false
type: string
default: 'ci-e2e-config.yaml'

env:
REGISTRY: ghcr.io
Expand All @@ -95,14 +75,10 @@ jobs:
steps:
- name: Display Inputs
run: |
echo "Chain Image: ${{ inputs.chain-image }}"
echo "Chain A Tag: ${{ inputs.chain-a-tag }}"
echo "Chain B Tag: ${{ inputs.chain-b-tag }}"
echo "Chain Upgrade Tag: ${{ inputs.chain-upgrade-tag }}"
echo "Upgrade Plan Name: ${{ inputs.upgrade-plan-name }}"
echo "Relayer Image:" ${{ inputs.relayer-image }}
echo "Relayer Type: ${{ inputs.relayer-type }}"
echo "Relayer Tag: ${{ inputs.relayer-tag }}"
echo "Test Entry Point: ${{ inputs.test-entry-point }}"
echo "Test: ${{ inputs.test }}"
echo "Github Ref Name: ${{ github.ref_name }}"
Expand Down Expand Up @@ -225,15 +201,9 @@ jobs:
- docker-build
- docker-build-wasm
env:
CHAIN_IMAGE: '${{ inputs.chain-image }}'
CHAIN_A_TAG: '${{ inputs.chain-a-tag }}'
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
RELAYER_IMAGE: '${{ inputs.relayer-image }}'
RELAYER_TAG: '${{ inputs.relayer-tag }}'
RELAYER_ID: '${{ inputs.relayer-type }}'
CHAIN_BINARY: '${{ inputs.chain-binary }}'
CHAIN_UPGRADE_TAG: '${{ inputs.chain-upgrade-tag }}'
CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}'
E2E_CONFIG_PATH: '${{ inputs.e2e-config-path }}'
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
Expand Down Expand Up @@ -268,17 +238,9 @@ jobs:
- docker-build
- docker-build-wasm
env:
CHAIN_IMAGE: '${{ inputs.chain-image }}'
CHAIN_A_TAG: '${{ inputs.chain-a-tag }}'
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
RELAYER_IMAGE: '${{ inputs.relayer-image }}'
RELAYER_TAG: '${{ inputs.relayer-tag }}'
RELAYER_ID: '${{ inputs.relayer-type }}'
CHAIN_BINARY: '${{ inputs.chain-binary }}'
CHAIN_UPGRADE_TAG: '${{ inputs.chain-upgrade-tag }}'
CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}'
# explicitly set to true so that if a test fails, it doesn't delete the chain and cause other tests to fail.
KEEP_CONTAINERS: "true"
E2E_CONFIG_PATH: '${{ inputs.e2e-config-path }}'
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ jobs:
build-and-push-docker-image-wasm: true
# if the test fails, we upload logs so that we can download them from the UI.
upload-logs: true
chain-image: ghcr.io/cosmos/ibc-go-wasm-simd
# with regular tests, both images are the same.
chain-a-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}'
chain-b-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}'
chain-binary: 'simd'
# only run the grandpa test suite for wasm tests.
test-entry-point: 'TestGrandpaTestSuite'
# exclude transfer tests which rely on removed packet event attributes: # https://github.com/cosmos/ibc-go/issues/6243
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ jobs:
build-and-push-docker-image: true
# if the test fails, we upload logs so that we can download them from the UI.
upload-logs: true
chain-image: ghcr.io/cosmos/ibc-go-simd
# with regular tests, both images are the same.
chain-a-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}'
chain-b-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}'
chain-binary: 'simd'
# on regular PRs we won't run upgrade tests.
# NOTE: we are exluding TestTransferTestSuite as we run this full suite instead of each individual test.
test-exclusions: 'TestUpgradeTestSuite,TestGrandpaTestSuite,TestIBCWasmUpgradeTestSuite,TestTransferTestSuite,TestAuthzTransferTestSuite,TestTransferTestSuiteSendReceive,TestTransferTestSuiteSendEnabled,TestTransferLocalhostTestSuite,TestConnectionTestSuite,TestInterchainAccountsGovTestSuite,TestIncentivizedTransferTestSuite,TestTransferForwardingTestSuite'
Expand Down
53 changes: 53 additions & 0 deletions e2e/ci-e2e-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file contains configuration for running e2e tests.
# Many of these fields can be overridden with environment variables.
# All fields that support this have the corresponding environment variable name in a comment beside the field.


# | Environment Variable | Description | Default Value |
# |----------------------|-------------------------------------------|------------------------------|
# | CHAIN_IMAGE | The image that will be used for the chain | ghcr.io/cosmos/ibc-go-simd |
# | CHAIN_A_TAG | The tag used for chain A | N/A (must be set) |
# | CHAIN_B_TAG | The tag used for chain B | N/A (must be set) |
# | CHAIN_BINARY | The binary used in the container | simd |
# | RELAYER_TAG | The tag used for the relayer | 1.10.0 |
# | RELAYER_ID | The type of relayer to use (rly/hermes) | hermes |


# see sample.config.yaml for a bare minimum configuration example.
# set env E2E_CONFIG_PATH to point to this file to use it.
---
chains:
# the entry at index 0 corresponds to CHAIN_A
- chainId: chainA-1
numValidators: 4
numFullNodes: 1
image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
binary: simd # override with CHAIN_BINARY

# the entry at index 1 corresponds to CHAIN_B
- chainId: chainB-1
numValidators: 4
numFullNodes: 1
image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
binary: simd # override with CHAIN_BINARY

activeRelayer: hermes # override with RELAYER_ID
relayers:
- id: hermes
image: ghcr.io/informalsystems/hermes
tag: "1.10.0"
- id: rly
image: ghcr.io/cosmos/relayer
tag: "latest"
- id: hyperspace
image: ghcr.io/misko9/hyperspace
tag: "20231122v39"

cometbft:
logLevel: info

debug:
# setting this value to true will force log collection even if the test passes.
dumpLogs: false
# settings this value to true will keep the containers running after the test finishes.
keepContainers: true
42 changes: 14 additions & 28 deletions e2e/testsuite/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -51,7 +52,8 @@ const (
ChainUpgradeTagEnv = "CHAIN_UPGRADE_TAG"
// ChainUpgradePlanEnv specifies the upgrade plan name
ChainUpgradePlanEnv = "CHAIN_UPGRADE_PLAN"
// E2EConfigFilePathEnv allows you to specify a custom path for the config file to be used.
// E2EConfigFilePathEnv allows you to specify a custom path for the config file to be used. It can be relative
// or absolute.
E2EConfigFilePathEnv = "E2E_CONFIG_PATH"
// KeepContainersEnv instructs interchaintest to not delete the containers after a test has run.
// this ensures that chain containers are not deleted after a test suite is run if other tests
Expand Down Expand Up @@ -131,20 +133,8 @@ func (tc TestConfig) validateChains() error {
return fmt.Errorf("chain config missing tag: %+v", cfg)
}

// TODO: validate chainID in https://github.com/cosmos/ibc-go/issues/4697
// these are not passed in the CI at the moment. Defaults are used.
if !IsCI() {
if cfg.ChainID == "" {
return fmt.Errorf("chain config missing chainID: %+v", cfg)
}
}

// TODO: validate number of nodes in https://github.com/cosmos/ibc-go/issues/4697
// these are not passed in the CI at the moment.
if !IsCI() {
if cfg.NumValidators == 0 && cfg.NumFullNodes == 0 {
return fmt.Errorf("chain config missing number of validators or full nodes: %+v", cfg)
}
if cfg.NumValidators == 0 && cfg.NumFullNodes == 0 {
return fmt.Errorf("chain config missing number of validators or full nodes: %+v", cfg)
}
}

Expand Down Expand Up @@ -438,17 +428,9 @@ func applyEnvironmentVariableOverrides(fromFile TestConfig) TestConfig {
// fromEnv returns a TestConfig constructed from environment variables.
func fromEnv() TestConfig {
return TestConfig{
ChainConfigs: getChainConfigsFromEnv(),
UpgradeConfig: getUpgradePlanConfigFromEnv(),
ActiveRelayer: os.Getenv(RelayerIDEnv),

// TODO: we can remove this, and specify these values in a config file for the CI
// in https://github.com/cosmos/ibc-go/issues/4697
RelayerConfigs: []relayer.Config{
getDefaultRlyRelayerConfig(),
getDefaultHermesRelayerConfig(),
getDefaultHyperspaceRelayerConfig(),
},
ChainConfigs: getChainConfigsFromEnv(),
UpgradeConfig: getUpgradePlanConfigFromEnv(),
ActiveRelayer: os.Getenv(RelayerIDEnv),
CometBFTConfig: CometBFTConfig{LogLevel: "info"},
}
}
Expand Down Expand Up @@ -500,8 +482,12 @@ func getChainConfigsFromEnv() []ChainConfig {

// getConfigFilePath returns the absolute path where the e2e config file should be.
func getConfigFilePath() string {
if absoluteConfigPath := os.Getenv(E2EConfigFilePathEnv); absoluteConfigPath != "" {
return absoluteConfigPath
if specifiedConfigPath := os.Getenv(E2EConfigFilePathEnv); specifiedConfigPath != "" {
absolutePath, err := filepath.Abs(specifiedConfigPath)
if err != nil {
panic(fmt.Errorf("failed to convert specified config path to absolute path: %w", err))
}
return absolutePath
}

homeDir, err := os.UserHomeDir()
Expand Down
3 changes: 0 additions & 3 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,6 @@ func GetIBCToken(fullTokenDenom string, portID, channelID string) transfertypes.
// use less resources and allow the tests to run faster.
// both the number of validators and full nodes can be overwritten in a config file.
func getValidatorsAndFullNodes(chainIdx int) (int, int) {
if IsCI() {
return 4, 1
}
tc := LoadConfig()
return tc.GetChainNumValidators(chainIdx), tc.GetChainNumFullNodes(chainIdx)
}
Expand Down
Loading