Skip to content

Faster, More Stable Tests! - #24191

Open
kalverra wants to merge 10 commits into
DX-5066/speed-product-fixesfrom
DX-5066/faster-integration
Open

kalverra wants to merge 10 commits into
DX-5066/speed-product-fixesfrom
DX-5066/faster-integration

Conversation

@kalverra

@kalverra kalverra commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Most of the suite's wall time was tests waiting on fixed sleeps and long poll intervals, with debug logging burning CPU on top. This cuts those waits, batches bulk inserts and defaults the heaviest integration tests to Info, so CI spends its time asserting instead of sleeping. Timer injection comes from #24190. Part of DX-5066. This is the top of the stack; results below cover all four layers.

How to review this stack

259 files change across the stack, but 173 of them are a single added t.Parallel() line. Read the layers marked Medium or High; skim layer 1's mechanical files.

# PR What it is Attention Start here
1 #24074 Waves 1+2 of t.Parallel() plus the fallout they opened up 🟠 Medium data_source.go, cltest.go
2 #24101 Namespaces generated IDs per test binary, fails fast on DB lock waits 🟡 Low-Medium pgtest.go, db.go
3 #24190 The only layer that changes production behaviour 🔴 High lease_lock.go, scheduler.go
4 this PR Test wall-clock work: fewer waits, batched inserts, quieter logs 🟠 Medium go_core_tests, cltest.go
  • Read bottom-up to check the story, top-down to check a failure: layer 1 is the cause of everything above it.
  • A Low rating means no line-by-line reading is needed, not that the layer can't break CI. The risk in a t.Parallel() diff is a test touching process-global state, and that risk is concentrated in the files linked above.
  • Don't assume a file's diff is final in the layer you're reading: pg/lease_lock_test.go changes in layers 1, 2 and 4.

Changes

Logging and keystore costs were a large share of the CPU, not the assertions
  • cltest built its logger at Debug whatever the config said; it now follows the config, and CL_TEST_DEBUG_LOGS=1 restores Debug when chasing a failure.
  • TestScryptParams drops scrypt to N=2^4 for test keystores; scrypt was 14% of llo CPU.
  • llo nodes default to Info with no P2P, pipeline or Mercury tracing, and the unused in-memory log observer is gone. LLO_TEST_DEBUG=1 restores the old behaviour. Output fell 192 MB → 45 MB in llo and 35 MB → 3.1 MB in features/ocr2.
The three slowest packages now start first

go test starts packages in command-line order, so llo, features/ocr2 and core/cmd used to start ~45s in and set the wall clock. SLOW_PACKAGES lists them first; a scheduling trick, not a fix.

Waits replaced or shortened, per test
test change before → after
features/ocr2 bootstrap job sets contractConfigTrackerPollInterval = "1s", was 1 min package 76s → 21s
cmd TestShell_BeholderLifecycle telemetry points at a local gRPC server instead of a closed port the exporter retried for 10s 24.5s → 1.4s
gateway/network TestHTTPClient_Send handlers wait on the request context, not Sleep(10s) ~11s → 2s
ccip/ocrimpls transmitter mine and sample blocks every 100ms, was 1-2s 15s → 1.8s per subtest
ccip/launcher WithTickInterval(100ms) from #24190 package 14.7s → 2.2s
synchronization health tests 50ms ping interval 10s → 0.1s each
pg TestLockedDB_TwoInstances wait 3 renewals instead of the full 10s lease 10s → 3.1s
pgtest txdb cancel test sleep 10s → 1s 10.8s → 1.8s
bridges async upsert 50ms upsert tick package 6.6s → 1.4s
vrf/v2 TestLogPollerFilterRegistered 10ms poll, 2s window package 8.5s → 4.3s
Bulk inserts batched in the slow ORM tests

Test_PipelineORM_DeleteRunsOlderThan now inserts 1,999 runs in one InsertFinishedRuns call (15s → 0.24s), and the pipeline-run-ID test does one ordered insert for 4,600 runs (14.6s → 0.3s). Both stay above the 1,000-row batch size, so batching is still covered.

Shorter LLO epochs in two integration tests

v31_blob_catchup and v31_restart_resumes run RMax 10 (5s epochs): 66-82s → ~28s. In aggregation_fault_tolerance the admits case stops as soon as both channels report, and the withholds negative window drops from 15s to 10s.

Results

This stack adds significant test parallelism and improvements. This had knock-on effects throughout the code:

No-Race

Metric develop faster-integration Change Evidence
Tests run 10037 10045 8 —
Broken tests 0 0 0 —
Flaky tests 8 1 -7 ✅ weak
Timeouts 0 0 0 —
Slow tests 31 5 -26 ✅ clear
Flaky iterations 5/20 (25.0%) 1/20 (5.0%) -20.0 pp ✅ unclear
Iteration wall time p50 1m37.914s 1m10.527s -27.387s (-28%) ✅ clear
Iteration wall time max 2m34.56s 1m24.764s -1m9.796s (-45%) ✅ —

Race

Metric develop-race faster-integration-race Change Evidence
Tests run 10037 10045 8 —
Broken tests 0 0 0 —
Flaky tests 30 13 -17 ✅ clear
Races 0 0 0 —
Timeouts 0 0 0 —
Slow tests 68 57 -11 ✅ unclear
Flaky iterations 10/10 (100.0%) 8/10 (80.0%) -20.0 pp ✅ unclear
Iteration wall time p50 4m41.508s 3m14.85s -1m26.659s (-31%) ✅ clear
Iteration wall time max 10m17.297s 3m49.806s -6m27.491s (-63%) ✅ —

Notes

  • No production code in this layer; everything is test helpers, test bodies and the CI script.
  • Info-by-default changes what a failure log shows: set CL_TEST_DEBUG_LOGS=1 or LLO_TEST_DEBUG=1 before reading a flake.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

CORA - Pending Reviewers

Codeowners Entry Overall Num Files Owners
* ⏳ 10 @smartcontractkit/foundations, @smartcontractkit/core
/core/capabilities/ ⏳ 1 @smartcontractkit/keystone, @smartcontractkit/capabilities-team
/core/capabilities/ccip/ ⏳ 2 @smartcontractkit/ccip-offchain
/core/services/job/ ⏳ 1 @smartcontractkit/foundations, @smartcontractkit/core
/core/services/ocr*/ ⏳ 4 @smartcontractkit/foundations, @smartcontractkit/core
/core/services/periodicbackup/ ⏳ 1 @smartcontractkit/foundations, @smartcontractkit/core
/core/services/pg/ ⏳ 1 @smartcontractkit/foundations, @smartcontractkit/core
/core/services/pipeline/ ⏳ 2 @smartcontractkit/foundations, @smartcontractkit/bix-framework, @smartcontractkit/core
/core/services/vrf/ ⏳ 1 @smartcontractkit/dev-services, @smartcontractkit/core
/core/services/workflows/ ⏳ 1 @smartcontractkit/keystone
go.md ⏳ 1 @smartcontractkit/core, @smartcontractkit/foundations

Legend: ✅ Approved | ❌ Changes Requested | 💬 Commented | 🚫 Dismissed | ⏳ Pending | ❓ Unknown

For more details, see the full review summary.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@kalverra kalverra changed the title DX 5066/faster integration test: cut test wall time (~146 s -> ~101 s locally) Nov 11, 2026
kalverra and others added 5 commits November 11, 2026 09:38
llo tests: add WithRMax and use RMax=10 (5s epochs instead of 50s) in
v31_blob_catchup and v31_restart_resumes, which waited out a full epoch.
Those two tests drop from 66-82s to ~28s.

cltest: use N=2^4 scrypt params for test keystores. The keyring is
re-encrypted on every key add; scrypt was 14% of llo CPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
llo aggregation_fault_tolerance: the admits case now stops once both
channels have reported instead of sitting out a fixed 15s window; the
withholds case window is 10s (was 15s).

syncer/v2 Test_StartReconciliation_RetriesWithBackoffV2: wait for >= 3
handler calls (2 failures + success) instead of exactly 1 event, which
was only true for ~200ms and was missed under load.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kalverra and others added 5 commits November 11, 2026 09:38
TestLockedDB_TwoInstances waits 3 renewal intervals instead of the full
10s lease. The ccip/ocrimpls transmitter tests mine and sample heads every
100ms instead of 1-2s (15s -> 1.8s per subtest).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Test_PipelineORM_DeleteRunsOlderThan created a cron job per run and ran
StoreRun for each of 2000 runs. One job now owns all runs and the rest are
inserted in one InsertFinishedRuns call (15s -> 0.24s).

Test_FindPipelineRunIDsByJobID inserted 4600 runs one at a time. A new
helper inserts them in one ordered statement so ids still interleave
across jobs (14.6s -> 0.3s).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
llo nodes ran at Debug with P2P tracing and verbose pipeline/Mercury
logging, plus an in-memory observer nothing read: ~190 MB of output per
package run. They now log at Info; LLO_TEST_DEBUG=1 turns the old
behaviour back on and the unused observer is gone.

cltest.NewApplicationWithConfig built its default logger at Debug
regardless of config. It now follows the config level;
CL_TEST_DEBUG_LOGS=1 restores Debug.

Measured: llo output 192 MB -> 45 MB, CPU -14%; features/ocr2 output
35 MB -> 3.1 MB, CPU -12%. Wall time per package is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… llo tests first

ccip/launcher: registrysyncer.WithTickInterval(100ms) so the test does not
wait out the 12 s sync tick (package 14.7 s -> 2.2 s).
bridges: the async upsert test uses a 50 ms interval (package 6.6 s -> 1.4 s).
vrf/v2: TestLogPollerFilterRegistered polls every 10 ms and checks for 2 s
instead of 5 s (package 8.5 s -> 4.3 s).
llo: move the aggregation_fault_tolerance and v31_blob_catchup wrappers above
the other integration tests. Parallel tests are released in source order, so
the two longest tests no longer wait ~26 s for a slot.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kalverra kalverra changed the title test: cut test wall time (~146 s -> ~101 s locally) Faster, More Stable Tests! Nov 11, 2026
@kalverra
kalverra force-pushed the DX-5066/faster-integration branch from 6652202 to a6da7c3 Compare November 11, 2026 21:21
@kalverra
kalverra removed this pull request from stack #24076 November 12, 2026 13:51
@kalverra
kalverra added this pull request to stack #24200 November 12, 2026 13:53
This was referenced Nov 12, 2026
@kalverra
kalverra removed this pull request from stack #24200 November 12, 2026 14:14
@kalverra
kalverra added this pull request to stack #24201 November 12, 2026 14:14
@kalverra kalverra added complexity:medium pr-triage: medium complexity risk:medium pr-triage: medium risk labels Nov 16, 2026
@kalverra

Copy link
Copy Markdown
Collaborator Author

PR Triage · Risk 🟡 Medium · Complexity 🟡 Medium

Suggests 1 approval, including one from an owner. Suggested reviewers: @brunotm, @jmank88.

Level Why
Risk Medium exported core/internal/cltest.NewKeyStore changed; 11 packages reference it (threshold 5); 9 recent commits by @kalverra into touched packages within 7d
Complexity Medium new code size 3,876 (Medium at 1,600)

Start Review Here

  1. NewKeyStore · core/internal/cltest/cltest.go:818 — blast radius: 11 packages
  2. appLogLevel · core/internal/cltest/cltest.go:261-266 — new function · +1 logic
  3. core/internal/features/ocr2/features_ocr2_helper.go — unmeasured file
  4. TestHTTPClient_Send · core/services/gateway/network/httpclient_test.go:93-131 — +6 logic
  5. TestBridgeCache_Response · core/bridges/cache_test.go:168-201 — +3 logic
    +7 more

Blast radius

2 changed exports are referenced by other packages. Threshold: 5 packages.

Blast radius fan-out

flowchart LR
  br0["core/internal/cltest.NewKeyStore"]
  br0 --> br1["core/services/blockhashstore"]
  br0 --> br2["core/services/cron"]
  br0 --> br3["core/services/feeds"]
  br0 --> br4["core/services/headreporter"]
  br0 --> br5["core/services/job"]
  br0 --> br6["core/services/keystore"]
  br0 --> br7["core/services/ocr"]
  br0 --> br8["core/services/ocr2"]
  br0 --> br9["core/services/pipeline"]
  br0 --> br10["core/services/vrf/proof"]
  br0 --> brm["+1 more packages"]
Loading
Visualizations

Score map

flowchart LR
  R["Risk: Medium"]
  rs["1 signal → floor Medium"]
  s0["blast radius core/internal/cltest.NewKeyStore (11 packages)"] --> rs
  rs --> R
  seq["sequential changes (9 in 7d)"] -->|"lifts Low → Medium"| R
  C["Complexity: Medium"]
  m0["new code size 3,876 ≥ 1,600"] --> C
  RT["Suggests 1 approval · one from an owner"]
  R --> RT
  classDef low fill:#dafbe1,stroke:#1a7f37,color:#1f2328;
  classDef medium fill:#fff8c5,stroke:#9a6700,color:#1f2328;
  classDef high fill:#ffebe9,stroke:#cf222e,color:#1f2328;
  class R medium;
  class C medium;
Loading

Change shape

pie title Change shape
    "Tests" : 2753
    "Source" : 316
    "Trivial" : 2
Loading

— distributed across 24 files

Files: 25 changed, 1 skipped
File Risk Complexity Why
core/capabilities/ccip/ocrimpls/contract_transmitter_test.go Low Medium unmeasured file (parse error); held at least Medium
core/cmd/shell_local_test.go Low Medium unmeasured file (parse error); held at least Medium
core/internal/features/ocr2/features_ocr2_helper.go Low Medium unmeasured file (parse error); held at least Medium
core/services/ocr2/plugins/llo/helpers_test.go Low Medium unmeasured file (parse error); held at least Medium
core/services/ocr2/plugins/llo/integration_test.go Low Medium unmeasured file (parse error); held at least Medium
core/bridges/cache_test.go Low Low
core/capabilities/ccip/launcher/integration_test.go Low Low
core/capabilities/remote/trigger_registration_load_test.go Low Low
core/internal/cltest/cltest.go Low Low
core/internal/features/ocr2/features_ocr2_test.go Low Low
core/internal/testutils/pgtest/txdb_test.go Low Low
core/services/gateway/network/httpclient_test.go Low Low
core/services/job/job_orm_test.go Low Low
core/services/ocr2/plugins/llo/don_bench_test.go Low Low
core/services/ocr2/plugins/llo/history_backfill_integration_test.go Low Low
core/services/periodicbackup/backup_test.go Low Low
core/services/pg/locked_db_test.go Low Low
core/services/pipeline/orm_test.go Low Low
core/services/pipeline/task.bridge_test.go Low Low
core/services/synchronization/chip_ingress_batch_client_test.go Low Low
core/services/synchronization/helpers_test.go Low Low
core/services/vrf/v2/listener_v2_log_listener_test.go Low Low
core/services/workflows/syncer/v2/workflow_syncer_v2_test.go Low Low
tools/bin/go_core_tests Low Low
1 skipped (documentation) go.md
Why these reviewers
Reviewer Share Last commit
@brunotm 41% 2026-11-04
@jmank88 21% 2026-09-16

Others who know this code: pavel-raykov 13%, denis-chernov-smartcontract 5%, RensR 4%.

Ranked by commits to the changed files. Commits in the 360 days before the base tip count, newer ones more. Requested everyone with at least 20% of the score, up to 4. Excluded the PR author, @kalverra. Considered only current organization members.

Metrics and policy
Metric PR value Scale Medium at High at
logic added (cognitive delta) 12 [█████░│░░░░░░░░░░░░│] 15 45
syntax change (AST delta) 1,060 [█████████████░░░░░░│] 1,600 —
new code size (Kolmogorov delta) 3,876 [████████│███████████] 1,600 —
most complex function (max function cognitive complexity) 48 [██████████████░░░░░│] 70 70

Risk signals: change spread ○ · subsystems ○ · hotspot ○ · blast radius ● · author familiarity ○ · floor Medium

pr-triage v0.0.0-20261115114818-e596a947e450 · policy 150d01a


What is this? · How is this calculated?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity:medium pr-triage: medium complexity risk:medium pr-triage: medium risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant