From 04837da92bd88ec8342968bb803ecf68772b6341 Mon Sep 17 00:00:00 2001 From: ducnt131 <62016666+anhductn2001@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:48:56 +0700 Subject: [PATCH 1/2] CI: Add e2e-test trigger and turn-off fail-fast workflows (#4) --- .github/workflows/e2e_test.yml | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/e2e_test.yml diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml new file mode 100644 index 00000000..de1d1c71 --- /dev/null +++ b/.github/workflows/e2e_test.yml @@ -0,0 +1,42 @@ +name: E2E Tests + +on: + workflow_dispatch: + pull_request: + types: + # trigger workflow if PR is opened directly as R4R. + - opened + # trigger workflow if changes are pushed to the branch. + - synchronize + # trigger workflow if PR is marked ready for review. + - ready_for_review + paths-ignore: + - 'docs/**' + - '**.md' + - 'LICENSE' + +permissions: + contents: read + packages: write + +jobs: + # e2e-tests-by runs the actual go test command to trigger the test. + e2e-tests: + strategy: + matrix: + tests: + - "e2e-test-ibc" + - "e2e-test-ibc-timeout" + fail-fast: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: dymensionxyz/e2e-tests + - name: Set up Go 1.21 + uses: actions/setup-go@v4 + with: + go-version: "1.21.4" + + - name: E2E Tests + run: make ${{ matrix.tests }} From 93be5df272d3c476cc964b5a1d6cc535a5ef073e Mon Sep 17 00:00:00 2001 From: GnaD <89174180+GNaD13@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:40:25 +0700 Subject: [PATCH 2/2] Fix: Fix test IBC Timeout (#8) --- .github/workflows/e2e-test-workflow-call.yml | 2 +- .github/workflows/e2e_test.yml | 2 +- Makefile | 8 ++++---- tests/ibc_timeout_test.go | 13 +++++++++---- tests/ibc_transfer_test.go | 5 +++-- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e-test-workflow-call.yml b/.github/workflows/e2e-test-workflow-call.yml index 10ddfd9a..de990ce2 100644 --- a/.github/workflows/e2e-test-workflow-call.yml +++ b/.github/workflows/e2e-test-workflow-call.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: tests: - - "e2e-test-ibc" + - "e2e-test-ibc-success" - "e2e-test-ibc-timeout" fail-fast: false runs-on: ubuntu-latest diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index de1d1c71..81251353 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: tests: - - "e2e-test-ibc" + - "e2e-test-ibc-success" - "e2e-test-ibc-timeout" fail-fast: false runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 03cbe2dd..1483f0c7 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,15 @@ ############################################################################### # Executes IBC tests via rollup-e2e-testing -e2e-test-ibc: - cd tests && go test -timeout=25m -race -v -run TestIBCTransfer . +e2e-test-ibc-success: + cd tests && go test -timeout=25m -race -v -run TestIBCTransferSuccess . # Executes IBC tests via rollup-e2e-testing e2e-test-ibc-timeout: cd tests && go test -timeout=25m -race -v -run TestIBCTransferTimeout . # Executes all tests via rollup-e2e-testing -e2e-test-all: e2e-test-ibc e2e-test-ibc-timeout +e2e-test-all: e2e-test-ibc-success e2e-test-ibc-timeout -.PHONY: e2e-test-ibc e2e-test-ibc-timeout e2e-test-all +.PHONY: e2e-test-ibc-success e2e-test-ibc-timeout e2e-test-all diff --git a/tests/ibc_timeout_test.go b/tests/ibc_timeout_test.go index 2f0f704a..e0e63f2f 100644 --- a/tests/ibc_timeout_test.go +++ b/tests/ibc_timeout_test.go @@ -2,6 +2,7 @@ package tests import ( "context" + "fmt" "testing" "cosmossdk.io/math" @@ -28,7 +29,7 @@ func TestIBCTransferTimeout(t *testing.T) { configFileOverrides := make(map[string]any) dymintTomlOverrides := make(testutil.Toml) dymintTomlOverrides["settlement_layer"] = "dymension" - dymintTomlOverrides["node_address"] = "http://dymension_100-1-val-0-TestIBCTransferTimeout:26657" + dymintTomlOverrides["node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "demo-dymension-rollapp" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides @@ -184,6 +185,11 @@ func TestIBCTransferTimeout(t *testing.T) { dymensionIBCDenom := transfertypes.ParseDenomTrace(dymensionTokenDenom).IBCDenom() testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, math.NewInt(0)) + // According to delayedack module, we need the rollapp to have finalizedHeight > ibcClientLatestHeight + // in order to trigger ibc timeout or else it will trigger callback + err = testutil.WaitForBlocks(ctx, 5, rollapp1) + require.NoError(t, err) + err = r.StartRelayer(ctx, eRep, ibcPath) require.NoError(t, err) @@ -196,11 +202,10 @@ func TestIBCTransferTimeout(t *testing.T) { }, ) - err = testutil.WaitForBlocks(ctx, 5, rollapp1) + err = testutil.WaitForBlocks(ctx, 10, dymension) require.NoError(t, err) // Assert funds were returned to the sender after the timeout has occured - testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) testutil.AssertBalance(t, ctx, rollapp1, rollappUserAddr, dymensionIBCDenom, math.NewInt(0)) - + testutil.AssertBalance(t, ctx, dymension, dymensionUserAddr, dymension.Config().Denom, walletAmount) } diff --git a/tests/ibc_transfer_test.go b/tests/ibc_transfer_test.go index 033fe41c..ecc64bef 100644 --- a/tests/ibc_transfer_test.go +++ b/tests/ibc_transfer_test.go @@ -2,6 +2,7 @@ package tests import ( "context" + "fmt" "testing" "cosmossdk.io/math" @@ -18,7 +19,7 @@ import ( const ibcPath = "dymension-demo" // TestStart is a basic test to assert that spinning up a dymension network with 1 validator works properly. -func TestIBCTransfer(t *testing.T) { +func TestIBCTransferSuccess(t *testing.T) { if testing.Short() { t.Skip() } @@ -28,7 +29,7 @@ func TestIBCTransfer(t *testing.T) { configFileOverrides := make(map[string]any) dymintTomlOverrides := make(testutil.Toml) dymintTomlOverrides["settlement_layer"] = "dymension" - dymintTomlOverrides["node_address"] = "http://dymension_100-1-val-0-TestIBCTransfer:26657" + dymintTomlOverrides["node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name()) dymintTomlOverrides["rollapp_id"] = "demo-dymension-rollapp" configFileOverrides["config/dymint.toml"] = dymintTomlOverrides