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

CCIP-4303:Enabling in-memory test in integration-tests workflow #15388

Merged
merged 18 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
13 changes: 0 additions & 13 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -948,19 +948,6 @@ runner-test-matrix:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
E2E_JD_VERSION: 0.6.0

- id: smoke/ccip/ccip_messaging_test.go:*
path: integration-tests/smoke/ccip/ccip_messaging_test.go
test_env_type: docker
runs_on: ubuntu-latest
triggers:
- PR E2E Core Tests
- Nightly E2E Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_messaging_test.go -timeout 15m -test.parallel=1 -count=1 -json
pyroscope_env: ci-smoke-ccipv1_6-evm-simulated
test_env_vars:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
E2E_JD_VERSION: 0.6.0

- id: smoke/ccip/ccip_batching_test.go:*
path: integration-tests/smoke/ccip/ccip_batching_test.go
test_env_type: docker
Expand Down
21 changes: 21 additions & 0 deletions .github/integration-in-memory-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file specifies the GitHub runner for each in-memory integration test and is utilized by .github/workflows/integration-in-memory-tests.yml CI workflow.
#
# Each entry in this file includes the following:
# - The GitHub runner (runs_on field) that will execute tests.
# - The tests that will be run by the runner.
# - The triggers (e.g., PR Integration CCIP Tests) that should trigger these tests.
#
runner-test-matrix:
# START: CCIPv1.6 tests

- id: smoke/ccip/ccip_messaging_test.go:*
path: integration-tests/smoke/ccip/ccip_messaging_test.go
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

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

why only messaging_test? Can we do a regex to run all under ccip directory? or maybe even create a new directory ccip-1.6 that has only 1.6 related tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just an example. I don't want to club the work to convert the test to sim backend in this PR. We can do that in a separate PR.

It's better to have it separate matrix to make it parallel and speed up the execution.

test_env_type: in-memory
runs_on: ubuntu-latest
triggers:
- PR Integration CCIP Tests
test_cmd: cd integration-tests/smoke/ccip && go test ccip_messaging_test.go -timeout 12m -test.parallel=2 -count=1 -json
b-gopalswami marked this conversation as resolved.
Show resolved Hide resolved
test_env_vars:
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
E2E_JD_VERSION: 0.6.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these env vars make sense in the sim env?

# END: CCIP tests
144 changes: 144 additions & 0 deletions .github/workflows/integration-in-memory-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#
# Workflow to run in-memory integration tests
# Test matrix is defined in .github/integration-in-memory-tests.yml
#
name: Integration Tests
b-gopalswami marked this conversation as resolved.
Show resolved Hide resolved
run-name: Integration Tests
on:
merge_group:
pull_request:
push:
tags:
- "*"
workflow_dispatch:
inputs:
cl_ref:
description: 'The ref to checkout, defaults to the calling branch'
required: false
type: string

# Only run 1 of this workflow at a time per PR
concurrency:
group: ${{ github.ref }}-${{ github.repository }}-${{ github.event_name }}--integration-tests
cancel-in-progress: true

jobs:
changes:
environment: integration
name: Check Paths That Require Tests To Run
runs-on: ubuntu-latest
# We don't directly merge dependabot PRs, so let's not waste the resources
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout the repo
uses: actions/[email protected]
with:
repository: smartcontractkit/chainlink
ref: ${{ inputs.cl_ref }}
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
github_ci_changes:
- '.github/workflows/integration-tests.yml'
- '.github/integration-tests.yml'
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these pointing to the right files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix it

core_changes:
- '**/*.go'
- '**/*go.sum'
- '**/*go.mod'
- '**/*Dockerfile'
- 'core/**/migrations/*.sql'
- 'core/**/config/**/*.toml'
- 'integration-tests/**/*.toml'
ccip_changes:
- '**/*ccip*'
- '**/*ccip*/**'
- name: Ignore Filter On Workflow Dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
id: ignore-filter
run: echo "changes=true" >> $GITHUB_OUTPUT
outputs:
github_ci_changes: ${{ steps.ignore-filter.outputs.changes || steps.changes.outputs.github_ci_changes }}
core_changes: ${{ steps.ignore-filter.outputs.changes || steps.changes.outputs.core_changes }}
ccip_changes: ${{ steps.ignore-filter.outputs.changes || steps.changes.outputs.ccip_changes }}
b-gopalswami marked this conversation as resolved.
Show resolved Hide resolved

run-ccip-integration-tests-for-pr:
name: Run CCIP integration Tests For PR
permissions:
actions: read
checks: write
pull-requests: write
id-token: write
contents: read
needs: changes
if: github.event_name == 'pull_request' && ( needs.changes.outputs.ccip_changes == 'true' || needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true')
uses: smartcontractkit/.github/.github/workflows/run-integration-tests.yml@57112554b9e5cfae79e795a8b1c36acf7e9dead7
with:
workflow_name: Run CCIP Integration Tests For PR
test_path: .github/integration-in-memory-tests.yml
test_trigger: PR Integration CCIP Tests
secrets:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}

run-ccip-integration-tests-for-merge-queue:
name: Run CCIP Integration Tests For Merge Queue
permissions:
actions: read
checks: write
pull-requests: write
id-token: write
contents: read
needs: changes
if: github.event_name == 'merge_group' && ( needs.changes.outputs.ccip_changes == 'true' || needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true')
uses: smartcontractkit/.github/.github/workflows/run-integration-tests.yml@57112554b9e5cfae79e795a8b1c36acf7e9dead7
with:
workflow_name: Run CCIP Integration Tests For Merge Queue
test_path: .github/integration-in-memory-tests.yml
test_trigger: Merge Queue integration CCIP Tests
slack_notification_after_tests: on_failure
slack_notification_after_tests_channel_id: "#ccip-testing"
slack_notification_after_tests_name: CCIP integration Tests In Merge Queue
secrets:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
b-gopalswami marked this conversation as resolved.
Show resolved Hide resolved

check-integration-test-results:
if: always()
name: Integration Tests
runs-on: ubuntu-latest
needs: [run-ccip-integration-tests-for-pr,run-ccip-integration-tests-for-merge-queue]
steps:
- name: Fail the job if ccip tests in PR not successful
if: always() && needs.run-ccip-integration-tests-for-pr.result == 'failure'
run: exit 1

- name: Fail the job if ccip tests in merge queue not successful
if: always() && needs.run-ccip-integration-tests-for-merge-queue.result == 'failure'
run: exit 1

cleanup:
name: Clean up integration environment deployments
if: always()
needs: [run-ccip-integration-tests-for-pr, run-ccip-integration-tests-for-merge-queue]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
if: ${{ github.event_name == 'pull_request' }}
uses: actions/[email protected]
with:
repository: smartcontractkit/chainlink
ref: ${{ inputs.cl_ref }}

- name: 🧼 Clean up Environment
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the soap 😁

if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/delete-deployments
with:
environment: integration
ref: ${{ github.head_ref }} # See https://github.com/github/docs/issues/15319#issuecomment-1476705663
b-gopalswami marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 1 addition & 4 deletions integration-tests/smoke/ccip/ccip_messaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/hashutil"
"github.com/smartcontractkit/chainlink-common/pkg/merklemulti"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"

"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset"
"github.com/smartcontractkit/chainlink/integration-tests/testsetups"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
Expand Down Expand Up @@ -47,9 +45,8 @@ type messagingTestCaseOutput struct {

func Test_CCIPMessaging(t *testing.T) {
// Setup 2 chains and a single lane.
lggr := logger.TestLogger(t)
ctx := changeset.Context(t)
e, _, _ := testsetups.NewLocalDevEnvironmentWithDefaultPrice(t, lggr, nil)
e := changeset.NewMemoryEnvironmentWithJobsAndContracts(t, logger.TestLogger(t), 2, 4, nil)

state, err := changeset.LoadOnchainState(e.Env)
require.NoError(t, err)
Expand Down
Loading