Skip to content
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
161 changes: 161 additions & 0 deletions .github/workflows/cre-wf-caching-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: CRE Workflow Caching Test

on:
workflow_dispatch:
inputs:
ecr_name:
description: "ECR repository name (default: chainlink)"
required: false
type: string
default: "chainlink"
chainlink_image_tag:
description: "Chainlink image tag to use"
required: true
type: string
workflow_call:
inputs:
ecr_name:
required: false
type: string
default: "chainlink"
chainlink_image_tag:
required: true
type: string

jobs:
caching:
name: CRE Workflow Caching Test
environment:
name: integration
deployment: false
runs-on: runs-on=${{ github.run_id
}}/cpu=32/ram=128/family=m6id+m6idn/spot=false/image=ubuntu24-full-x64/extras=s3-cache
Comment thread
Tofel marked this conversation as resolved.
timeout-minutes: 270 # 4h30m — test timeout is 4h20m
permissions:
contents: read
id-token: write

steps:
- name: Enable S3 Cache for Self-Hosted Runners
uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2.1.0
with:
metrics: cpu,network,memory,disk,io

- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Set up Go
id: setup-go
uses: actions/setup-go@v6
with:
go-version-file: system-tests/tests/go.mod
cache: true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1

Check warning on line 58 in .github/workflows/cre-wf-caching-test.yml

View workflow job for this annotation

GitHub Actions / Validate Workflow Changes

1. Action is using node20. Versions older than node24 are being deprecated. Use a newer version of the action if possible. (node-version / warning)
with:
aws-region: ${{ secrets.QA_AWS_REGION }}
role-to-assume: ${{ secrets.AWS_CTF_READ_ACCESS_ROLE_ARN }}
role-duration-seconds: 3600
mask-aws-account-id: true

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1

Check warning on line 67 in .github/workflows/cre-wf-caching-test.yml

View workflow job for this annotation

GitHub Actions / Validate Workflow Changes

1. Action is using node20. Versions older than node24 are being deprecated. Use a newer version of the action if possible. (node-version / warning)
with:
registries: ${{ format('{0},{1}', secrets.QA_AWS_ACCOUNT_NUMBER,
secrets.AWS_ACCOUNT_ID_PROD) }}
env:
AWS_REGION: ${{ secrets.QA_AWS_REGION }}

- name: Start observability stack
shell: bash
working-directory: core/scripts/cre/environment
env:
OBS_MAX_ATTEMPTS: "3"
OBS_RETRY_DELAY_SECONDS: "15"
run: |
set -u
attempt=1
while [[ "$attempt" -le "$OBS_MAX_ATTEMPTS" ]]; do
echo "::group::Starting observability stack (attempt ${attempt}/${OBS_MAX_ATTEMPTS}, required by caching test)"
if go run . obs up -f; then
echo "::endgroup::"
exit 0
fi
echo "::endgroup::"
if [[ "$attempt" -lt "$OBS_MAX_ATTEMPTS" ]]; then
go run . obs down || true
sleep "$OBS_RETRY_DELAY_SECONDS"
fi
attempt=$((attempt + 1))
done
exit 1

- name: Start local CRE
uses: ./.github/actions/start-local-cre-environment
with:
jd-image:
"${{ secrets.AWS_ACCOUNT_ID_PROD }}.dkr.ecr.${{ secrets.QA_AWS_REGION
}}.amazonaws.com/job-distributor:0.22.1"
# TODO - remove nightly image fallback after testing
chainlink-image: "${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{
secrets.QA_AWS_REGION }}.amazonaws.com/${{ inputs.ecr_name ||
'chainlink' }}:${{ inputs.chainlink_image_tag }}"
ctf-configs: configs/workflow-gateway-don-cache-soak-test.toml
chip-router-image: "${{ secrets.QA_AWS_ACCOUNT_NUMBER
}}.dkr.ecr.${{secrets.QA_AWS_REGION
}}.amazonaws.com/local-cre-chip-router:v1.0.1"
retry-count: "3"
retry-delay-seconds: "15"
cleanup-on-error: "false"
working-directory: core/scripts/cre/environment

- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@v1.12.3

- name: Run CRE Workflow Caching Test
id: run-caching
shell: bash
working-directory: system-tests/tests
env:
CTF_CHIP_INGRESS_IMAGE:
"${{ secrets.AWS_ACCOUNT_ID_PROD }}.dkr.ecr.${{
secrets.QA_AWS_REGION
}}.amazonaws.com/atlas-chip-ingress:da84cb72d3a160e02896247d46ab4b9\
806ebee2f"
CTF_CHIP_CONFIG_IMAGE: "${{ secrets.AWS_ACCOUNT_ID_PROD }}.dkr.ecr.${{
secrets.QA_AWS_REGION
}}.amazonaws.com/atlas-chip-config:7b4e9ee68fd1c737dd3480b5a3ced018\
8f29b969"
CRE_SOAK_DURATION: "4h"
run: |
gotestsum \
--jsonfile=/tmp/gotest.log \
--junitfile=/tmp/junit-report.xml \
--format=github-actions \
-- \
-v -run "^Test_V2_CRE_CacheSoak$" \
-timeout 4h20m \
-count=1 \
github.com/smartcontractkit/chainlink/system-tests/tests/soak/cre

- name: Upload metrics
if: always()
uses: actions/upload-artifact@v7
with:
name: metrics
path: system-tests/tests/soak/cre/metrics
retention-days: 7

- name: Upload Docker logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: caching-docker-logs
path: system-tests/tests/soak/cre/logs
retention-days: 7
9 changes: 9 additions & 0 deletions .github/workflows/post-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@ jobs:
with:
chainlink_image_tag: ${{ inputs.chainlink_core_image_tag }}
secrets: inherit

call-cre-workflow-caching-tests:
permissions:
contents: read
id-token: write
uses: ./.github/workflows/cre-wf-caching-test.yml
with:
chainlink_image_tag: ${{ inputs.chainlink_core_image_tag }}
secrets: inherit
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[chip_router]
image = "local-cre-chip-router:v1.0.1"

[[blockchains]]
type = "anvil"
chain_id = "1337"
container_name = "anvil-1337"
docker_cmd_params = ["-b", "0.5", "--mixed-mining"]

[[blockchains]]
type = "anvil"
chain_id = "2337"
container_name = "anvil-2337"
port = "8546"
docker_cmd_params = ["-b", "0.5", "--mixed-mining"]

[jd]
csa_encryption_key = "d1093c0060d50a3c89c189b2e485da5a3ce57f3dcb38ab7e2c0d5f0bb2314a44"
image = "job-distributor:0.22.1"

[fake]
port = 8171

[fake_http]
port = 8666

[infra]
type = "docker"

[[nodesets]]
nodes = 4
name = "workflow"
don_types = ["workflow"]
override_mode = "all"
http_port_range_start = 10100

env_vars = { CL_EVM_CMD = "" }
capabilities = ["vault", "cron", "http-action", "http-trigger", "consensus", "don-time", "evm-1337", "evm-2337"]
registry_based_launch_allowlist = ["cron-trigger@1.0.0"]

[nodesets.db]
image = "postgres:12.0"
port = 13000

[[nodesets.node_specs]]
roles = ["plugin"]
[nodesets.node_specs.node]
docker_ctx = "../../../.."
docker_file = "core/chainlink.Dockerfile"
docker_build_args = { "CL_IS_PROD_BUILD" = "false" }
user_config_overrides = """
[Capabilities.WorkflowRegistry.ModuleCache]
Enabled = true
# Sized for ~50% of 128GiB host at cap; per loaded slot ~= WASMBinarySizeLimit + WASMMemoryLimit (100MiB each by default).
MaxLoaded = 100
IdleEviction = true
# Long enough that 3m fast cron stays hot and 8m slow cron idles out between runs.
IdleTimeout = '5m'

[Workflows.Limits]
Global = 5000
PerOwner = 5000
"""

[[nodesets]]
nodes = 1
name = "bootstrap-gateway"
don_types = ["bootstrap", "gateway"]
override_mode = "each"
http_port_range_start = 10300

env_vars = { CL_EVM_CMD = "" }
supported_evm_chains = [1337, 2337]

[nodesets.db]
image = "postgres:12.0"
port = 13200

[[nodesets.node_specs]]
roles = ["bootstrap", "gateway"]
[nodesets.node_specs.node]
docker_ctx = "../../../.."
docker_file = "core/chainlink.Dockerfile"
docker_build_args = { "CL_IS_PROD_BUILD" = "false" }
custom_ports = ["5002:5002","15002:15002"]
user_config_overrides = ""
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ require (
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260514104516-a827acdffe43
github.com/smartcontractkit/chainlink-protos/job-distributor v0.18.0
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.1
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.2
github.com/smartcontractkit/chainlink-testing-framework/framework/components/dockercompose v0.1.23
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5
github.com/smartcontractkit/chainlink/core/scripts/cre/environment/examples/workflows/proof-of-reserve/cron-based v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion system-tests/lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/smartcontractkit/chainlink-protos/job-distributor v0.18.0
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20260323124644-faea187e6997
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.1
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.2
github.com/smartcontractkit/chainlink-testing-framework/framework/components/chiprouter v1.0.4
github.com/smartcontractkit/chainlink-testing-framework/framework/components/dockercompose v0.1.23
github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake v0.15.0
Expand Down
4 changes: 2 additions & 2 deletions system-tests/lib/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions system-tests/tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ logs/

*.yaml
env_artifact/
metrics/
4 changes: 2 additions & 2 deletions system-tests/tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ require (
github.com/gin-gonic/gin v1.10.1
github.com/google/uuid v1.6.0
github.com/lib/pq v1.12.3
github.com/moby/moby/client v0.4.1
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.34.0
github.com/smartcontractkit/chain-selectors v1.0.100
Expand All @@ -62,7 +63,7 @@ require (
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260514104516-a827acdffe43
github.com/smartcontractkit/chainlink-protos/ring/go v0.0.0-20260331131315-f08a616d8dcd
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20260323124644-faea187e6997
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.1
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.2
github.com/smartcontractkit/chainlink-testing-framework/framework/components/chiprouter v1.0.4
github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake v0.15.0
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5
Expand Down Expand Up @@ -127,7 +128,6 @@ require (
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/moby/moby/api v1.54.2 // indirect
github.com/moby/moby/client v0.4.1 // indirect
github.com/oapi-codegen/runtime v1.1.2 // indirect
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
github.com/pressly/goose/v3 v3.27.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions system-tests/tests/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 1 addition & 32 deletions system-tests/tests/smoke/cre/v2_module_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ package cre
import (
"context"
"fmt"
"os/exec"
"strings"
"testing"
"time"

"github.com/stretchr/testify/assert"

commonevents "github.com/smartcontractkit/chainlink-protos/workflows/go/common"
workflowevents "github.com/smartcontractkit/chainlink-protos/workflows/go/events"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
Expand Down Expand Up @@ -68,7 +64,7 @@ func ExecuteModuleCacheTest(t *testing.T, testEnv *ttypes.TestEnvironment) {

drainFor(userLogsCh, cacheObserveWindow)

assertNodeLogs(t, testEnv, "Module cache enabled")
t_helpers.AssertNodeLogs(t, testEnv, "Module cache enabled")
}

func drainFor(ch <-chan *workflowevents.UserLogs, d time.Duration) {
Expand All @@ -81,30 +77,3 @@ func drainFor(ch <-chan *workflowevents.UserLogs, d time.Duration) {
}
}
}

func assertNodeLogs(t *testing.T, testEnv *ttypes.TestEnvironment, needle string) {
t.Helper()

found := false
for _, nodeSet := range testEnv.Config.NodeSets {
if nodeSet.Out == nil {
continue
}
for _, clNode := range nodeSet.Out.CLNodes {
name := clNode.Node.ContainerName
if name == "" {
continue
}
out, err := exec.CommandContext(t.Context(), "docker", "logs", name).CombinedOutput()
if err != nil {
framework.L.Warn().Str("container", name).Err(err).Msg("could not read docker logs")
continue
}
if strings.Contains(string(out), needle) {
found = true
framework.L.Info().Str("container", name).Msg("confirmed: " + needle)
}
}
}
assert.True(t, found, "expected at least one node container log to contain %q", needle)
}
Loading
Loading