Skip to content

Commit

Permalink
Use multiple EL clients with ocrv2 median smoke test (#11399)
Browse files Browse the repository at this point in the history
* use multiple EL clients with ocrv2 median test

* update ethereum network component to latest

* try with latest implementation of eth clients

* change WithTestLogger() to WithTestInstance()

* fix geth backward compatibility

* run ocrv2 eth2 tests in parallel

* run also ocr1 and 2 vrf tests iwth multiple clients

* try running multipl el client tests in parallel

* fix go.sum

* fix lint

* 1. add matrix for running 4 smoke tests on different execution clients, 2. if for these tests no client is set in env var use geth

* comment out failing nethermind & besu vrf tests in the CI

* fix go.sum

* do not use negative lookahead with go test

* use faster eth2 network config

* add comment to integration tests workflow

* run only OCR and OCRv2 jobs with multiple clients, add on-demand jobs for VRF

* use latest ctf with increased network timeout

* slow down private eth networks a bit

* update CTF dep to tagged version

* disable nethermind ocr smoke tests in CI

* fix compilation errors
  • Loading branch information
Tofel authored and Borja Aranda committed Dec 14, 2023
1 parent 69dc8df commit ce4e858
Show file tree
Hide file tree
Showing 26 changed files with 303 additions and 45 deletions.
67 changes: 66 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,73 @@ jobs:
- name: ocr
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRJobReplacement
file: ocr
pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr-geth
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRBasic
file: ocr
client: geth
pyroscope_env: ci-smoke-ocr-evm-simulated
# Uncomment, when https://smartcontract-it.atlassian.net/browse/TT-753 is DONE
# - name: ocr-nethermind
# nodes: 1
# os: ubuntu20.04-8cores-32GB
# run: -run TestOCRBasic
# file: ocr
# client: nethermind
# pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr-besu
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRBasic
file: ocr
client: besu
pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr-erigon
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRBasic
file: ocr
client: erigon
pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr2
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRv2JobReplacement
file: ocr2
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2-geth
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRv2Basic
file: ocr2
client: geth
pyroscope_env: ci-smoke-ocr2-evm-simulated
# Uncomment, when https://smartcontract-it.atlassian.net/browse/TT-753 is DONE
# - name: ocr2-nethermind
# nodes: 1
# os: ubuntu20.04-8cores-32GB
# run: -run TestOCRv2Basic
# file: ocr2
# client: nethermind
# pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2-besu
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRv2Basic
file: ocr2
client: besu
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2-erigon
nodes: 1
os: ubuntu20.04-8cores-32GB
run: -run TestOCRv2Basic
file: ocr2
client: erigon
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2
nodes: 1
os: ubuntu20.04-8cores-32GB
Expand All @@ -345,12 +407,14 @@ jobs:
pyroscope_env: ci-smoke-vrf-evm-simulated
- name: vrfv2
nodes: 1
run: -run TestVRFv2MultipleSendingKeys
file: vrfv2
os: ubuntu20.04-8cores-32GB
pyroscope_env: ci-smoke-vrf2-evm-simulated
- name: vrfv2plus
nodes: 1
os: ubuntu20.04-8cores-32GB
pyroscope_env: ci-smoke-vrf2plus-evm-simulated
pyroscope_env: ci-smoke-vrf2plus-evm-simulated
- name: forwarder_ocr
nodes: 1
os: ubuntu20.04-8cores-32GB
Expand Down Expand Up @@ -435,6 +499,7 @@ jobs:
PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725
PYROSCOPE_ENVIRONMENT: ${{ matrix.product.pyroscope_env }}
PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }}
ETH2_EL_CLIENT: ${{matrix.product.client}}
LOKI_TENANT_ID: ${{ vars.LOKI_TENANT_ID }}
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/on-demand-vrfv2-eth2-clients-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: On Demand VRFV2 Smoke Test (Ethereum clients)
on:
workflow_dispatch:
inputs:
client:
description: Execution client to use
type: choice
options:
- "geth"
- "nethermind"
- "besu"
- "erigon"
chainlinkImage:
description: Container image location for the Chainlink nodes
required: true
default: public.ecr.aws/chainlink/chainlink
chainlinkVersion:
description: Container image version for the Chainlink nodes
required: true
default: "2.6.0"
configBase64:
description: TOML config in base64 (Needed when overriding config or providing contract addresses for existing env)
required: false
jobs:
vrfv2_smoke_test:
name: VRFV2 Smoke Test with ${{ inputs.client }} client
environment: integration
runs-on: ubuntu20.04-8cores-32GB
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
env:
SELECTED_NETWORKS: "SIMULATED"
CONFIG: ${{ inputs.configBase64 }}
TEST_LOG_LEVEL: debug
REF_NAME: ${{ github.head_ref || github.ref_name }}
CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }}
CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }}
steps:
- name: Setup Push Tag
shell: bash
run: |
echo "### chainlink image used for this test run :link:" >>$GITHUB_STEP_SUMMARY
echo "\`${{ inputs.chainlinkVersion }}\`" >>$GITHUB_STEP_SUMMARY
echo "### chainlink-tests image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
echo "\`${GITHUB_SHA}\`" >>$GITHUB_STEP_SUMMARY
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@7d541cbbca52d45b8a718257af86d9cf49774d1f # v2.2.15
with:
test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -run TestVRFv2Basic ./smoke/vrfv2_test.go 2>&1 | tee /tmp/gotest.log | gotestfmt
test_download_vendor_packages_command: cd ./integration-tests && go mod download
cl_repo: ${{ inputs.chainlinkImage }}
cl_image_tag: ${{ inputs.chainlinkVersion }}
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
artifacts_name: vrf-test-logs
artifacts_location: ./integration-tests/smoke/logs/
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
should_cleanup: false
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
env:
ETH2_EL_CLIENT: ${{ inputs.client }}
70 changes: 70 additions & 0 deletions .github/workflows/on-demand-vrfv2plus-eth2-clients-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: On Demand VRFV2Plus Smoke Test (Ethereum clients)
on:
workflow_dispatch:
inputs:
client:
description: Execution client to use
type: choice
options:
- "geth"
- "nethermind"
- "besu"
- "erigon"
chainlinkImage:
description: Container image location for the Chainlink nodes
required: true
default: public.ecr.aws/chainlink/chainlink
chainlinkVersion:
description: Container image version for the Chainlink nodes
required: true
default: "2.6.0"
configBase64:
description: TOML config in base64 (Needed when overriding config or providing contract addresses for existing env)
required: false
jobs:
vrfv2plus_smoke_test:
name: VRFV2Plus Smoke Test with ${{ inputs.client }} client
environment: integration
runs-on: ubuntu20.04-8cores-32GB
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
env:
SELECTED_NETWORKS: "SIMULATED"
CONFIG: ${{ inputs.configBase64 }}
TEST_LOG_LEVEL: debug
REF_NAME: ${{ github.head_ref || github.ref_name }}
CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }}
CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }}
steps:
- name: Setup Push Tag
shell: bash
run: |
echo "### chainlink image used for this test run :link:" >>$GITHUB_STEP_SUMMARY
echo "\`${{ inputs.chainlinkVersion }}\`" >>$GITHUB_STEP_SUMMARY
echo "### chainlink-tests image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
echo "\`${GITHUB_SHA}\`" >>$GITHUB_STEP_SUMMARY
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@7d541cbbca52d45b8a718257af86d9cf49774d1f # v2.2.15
with:
test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -run ^TestVRFv2Plus$/^Link_Billing$ ./smoke/vrfv2plus_test.go 2>&1 | tee /tmp/gotest.log | gotestfmt
test_download_vendor_packages_command: cd ./integration-tests && go mod download
cl_repo: ${{ inputs.chainlinkImage }}
cl_image_tag: ${{ inputs.chainlinkVersion }}
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
artifacts_name: vrfplus-test-logs
artifacts_location: ./integration-tests/smoke/logs/
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
should_cleanup: false
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
env:
ETH2_EL_CLIENT: ${{ inputs.client }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ go.work*
tools/flakeytests/coverage.txt

.test_summary/
.run.id
.run.id
33 changes: 33 additions & 0 deletions integration-tests/actions/private_network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package actions

import (
"errors"

"github.com/rs/zerolog"

ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env"
)

func EthereumNetworkConfigFromEnvOrDefault(l zerolog.Logger) (network ctf_test_env.EthereumNetwork, err error) {
chainConfig := ctf_test_env.EthereumChainConfig{
SecondsPerSlot: 8,
SlotsPerEpoch: 4,
}

ethBuilder := ctf_test_env.NewEthereumNetworkBuilder()
network, err = ethBuilder.
WithExecClientFromEnvVar().
WithEthereumChainConfig(chainConfig).
Build()

if errors.Is(err, ctf_test_env.ErrMissingExecClientEnvVar) {
l.Warn().Msg("No exec client env var set, will use old geth")
ethBuilder = ctf_test_env.NewEthereumNetworkBuilder()
network, err = ethBuilder.
WithConsensusType(ctf_test_env.ConsensusType_PoW).
WithExecutionLayer(ctf_test_env.ExecutionLayer_Geth).
Build()
}

return
}
2 changes: 1 addition & 1 deletion integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *ch
func (n *ClNode) SetTestLogger(t *testing.T) {
n.l = logging.GetTestLogger(t)
n.t = t
n.PostgresDb.WithTestLogger(t)
n.PostgresDb.WithTestInstance(t)
}

// Restart restarts only CL node, DB container is reused
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/docker/test_env/test_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func (te *CLClusterTestEnv) WithTestEnvConfig(cfg *TestEnvConfig) *CLClusterTest
return te
}

func (te *CLClusterTestEnv) WithTestLogger(t *testing.T) *CLClusterTestEnv {
func (te *CLClusterTestEnv) WithTestInstance(t *testing.T) *CLClusterTestEnv {
te.t = t
te.l = logging.GetTestLogger(t)
if te.MockAdapter != nil {
te.MockAdapter.WithTestLogger(t)
te.MockAdapter.WithTestInstance(t)
}
return te
}
Expand All @@ -90,7 +90,7 @@ func (te *CLClusterTestEnv) WithPrivateChain(evmNetworks []blockchain.EVMNetwork
n := evmNetwork
pgc := test_env.NewPrivateGethChain(&n, []string{te.Network.Name})
if te.t != nil {
pgc.GetPrimaryNode().WithTestLogger(te.t)
pgc.GetPrimaryNode().WithTestInstance(te.t)
}
chains = append(chains, pgc)
var privateChain test_env.PrivateChain
Expand Down
10 changes: 7 additions & 3 deletions integration-tests/docker/test_env/test_env_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (b *CLTestEnvBuilder) WithTestEnv(te *CLClusterTestEnv) (*CLTestEnvBuilder,

// WithTestLogger sets the test logger to use for the test.
// Useful for parallel tests so the logging will be separated correctly in the results views.
func (b *CLTestEnvBuilder) WithTestLogger(t *testing.T) *CLTestEnvBuilder {
func (b *CLTestEnvBuilder) WithTestInstance(t *testing.T) *CLTestEnvBuilder {
b.t = t
b.l = logging.GetTestLogger(t)
return b
Expand Down Expand Up @@ -220,8 +220,12 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) {
}

var err error
if b.t != nil {
b.te.WithTestInstance(b.t)
}

if b.hasLogStream {
b.te.LogStream, err = logstream.NewLogStream(b.t, nil)
b.te.LogStream, err = logstream.NewLogStream(b.te.t, nil)
if err != nil {
return nil, err
}
Expand All @@ -241,7 +245,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) {
}

if b.t != nil {
b.te.WithTestLogger(b.t)
b.te.WithTestInstance(b.t)
}

switch b.cleanUpType {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.1
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231206181640-faad3f11cfad
github.com/smartcontractkit/chainlink-testing-framework v1.21.0
github.com/smartcontractkit/chainlink-testing-framework v1.22.0
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT
github.com/shirou/gopsutil/v3 v3.23.11 h1:i3jP9NjCPUz7FiZKxlMnODZkdSIp2gnzfrvsu9CuWEQ=
github.com/shirou/gopsutil/v3 v3.23.11/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
Expand Down Expand Up @@ -1444,8 +1445,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231206154215-ec1718b7df3
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231206154215-ec1718b7df3e/go.mod h1:9YIi413QRRytafTzpWm+Z+5NWBNxSqokhKyeEZ3ynlA=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231205180940-ea2e3e916725 h1:NbhPVwxx+53WN/Uld1V6c4iLgoGvUYFOsVd2kfcexe8=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231205180940-ea2e3e916725/go.mod h1:vHrPBipRL52NdPp77KXNU2k1IoCUa1B33N9otZQPYko=
github.com/smartcontractkit/chainlink-testing-framework v1.21.0 h1:MrtpGMgPpcRX06FtDEj14Vokoo6Sx8e0/D6AA9LxCgM=
github.com/smartcontractkit/chainlink-testing-framework v1.21.0/go.mod h1:9SCqZ+lcWZNEofpPgasQ+wUF6A6fFgZvWmhqQJwFYV0=
github.com/smartcontractkit/chainlink-testing-framework v1.22.0 h1:Lur628wkrceWgcLmxGZe7Mauwxht4YO71hX9Jj5YslE=
github.com/smartcontractkit/chainlink-testing-framework v1.22.0/go.mod h1:yu6qqrppNJfutQV37fiSs4eS0uQP5QT0ebi3tlIgWN0=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss=
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/vrfv2/vrfv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestVRFV2Performance(t *testing.T) {
vrfv2Config.KeyHash = cfg.ExistingEnvConfig.KeyHash

env, err = test_env.NewCLTestEnvBuilder().
WithTestLogger(t).
WithTestInstance(t).
WithCustomCleanup(
func() {
teardown(t, vrfv2Contracts.LoadTestConsumers[0], lc, updatedLabels, testReporter, testType, vrfv2Config)
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestVRFV2Performance(t *testing.T) {
vrfv2Config.ChainlinkNodeFunding = cfg.NewEnvConfig.NodeSendingKeyFunding
vrfv2Config.SubscriptionFundingAmountLink = cfg.NewEnvConfig.Funding.SubFundsLink
env, err = test_env.NewCLTestEnvBuilder().
WithTestLogger(t).
WithTestInstance(t).
WithGeth().
WithCLNodes(1).
WithFunding(big.NewFloat(vrfv2Config.ChainlinkNodeFunding)).
Expand Down
Loading

0 comments on commit ce4e858

Please sign in to comment.