Skip to content

ci(e2e): cut avoidable setup time from the e2e workflow - #1459

Merged
lklimek merged 5 commits into
v1.8-devfrom
chore/e2e-ci-speedup
Sep 14, 2026
Merged

lklimek merged 5 commits into
v1.8-devfrom
chore/e2e-ci-speedup

Conversation

@lklimek

@lklimek lklimek commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: The end-to-end test job in CI takes about 20 minutes. This PR removes avoidable waiting in how that job is set up, and checks the test nodes several at a time instead of one by one, so results arrive sooner. What is tested stays exactly the same.

User story

As a contributor opening a pull request, I want the end-to-end tests to report back faster, so I can iterate on changes without waiting on avoidable CI overhead.

Scenario

Base flow

A contributor pushes a change touching Go code and waits for the two end-to-end jobs (dashcore, rotate) to finish.

Actual behavior

Each job compiles the test tooling from scratch every time, because its cache never loads. Both jobs also upload the same large Docker cache. The longer rotate job waits for that upload before it can start testing.

Once the test network is running, the final checks visit each of its 13 nodes one at a time.

Expected behavior

The test tooling is restored from cache, and only the shorter job uploads the Docker cache. The final checks visit up to 4 nodes at once. The same tests then run against the same network setups, but they start sooner and finish sooner.

Detailed discussion

What was done

  • Go cache (.github/workflows/e2e.yml): actions/setup-go ran before actions/checkout, so its cache step found no go.mod and never restored anything (Restore cache failed: Dependencies file is not found). "Build runner and tests" was a cold 92–99s build on every leg.

    • It now runs after checkout with a dedicated key: go.sum, test/e2e/Makefile, BLS headers. The default go.mod-hash key is shared with tests.yml/lint.yml, whose caches hold -race/lint artifacts.
    • The BLS headers are in the key because Go's build cache does not track cgo's external C dependencies.
  • Docker layer cache: both legs read type=gha, but only the dashcore leg exports it (cache-to is empty on rotate). This removes ~21s of "exporting to GitHub Actions Cache" from the critical rotate leg.

  • .git excluded from the E2E image context via test/e2e/docker/Dockerfile.dockerignore, a BuildKit per-Dockerfile ignore file that replaces the root one for this build only.

    • The root .dockerignore is unchanged in content: DOCKER/Dockerfile (release images) stamps the version via git describe.
    • The E2E node build does not use git metadata.
    • This makes the build context deterministic across checkouts, so the COPY . . / make node layers can be reused, e.g. when a flaky run is retried on the same commit.
  • Not done: overlapping the host build with the Docker build. With the Go cache fixed the host build drops to ~5–15s, so the ≤15s gain doesn't justify a background process that has to survive across steps.

  • Parallel per-node subtests (test/e2e/tests, test/e2e/runner/test.go), in a separate commit. testNode ran every node subtest sequentially, so the test phase took ~93s on rotate's 13 stateful nodes.

    • Node subtests now call t.Parallel(), capped at 4 via -test.parallel in the runner (a named constant). The cap matches CI's GOMAXPROCS and bounds RPC load on 4-vCPU runners.
    • Top-level tests stay sequential, and the tests, nodes and assertions are unchanged.
    • Safety review: the only shared mutable state reached from node subtests was TestApp_Tx's *rand.Rand, which is now mutex-guarded. The testnet and block caches and the node sort are only touched in parent test bodies, node subtests only read shared blocks and manifest data, and each subtest creates its own RPC client and ctx.
    • History: upstream tendermint #7516 removed t.Parallel() here together with adding -test.v and node sorting, with no stated reason.
    • Expected test phase on rotate: ~93s → ~35–45s.

Unchanged: matrix (dashcore, rotate), fail-fast, runner invocation and networks, node build flags (-gcflags=all=-N -l -tags deadlock), GIT_DIFF gating, log upload and cleanup.

Measured baseline, 7 recent green runs: rotate leg 1103–1286s = setup ~40s + host build 92–99s + docker 151–248s + testnet 808–961s.

Testing

  • actionlint 1.7.12: no findings. yamllint with the repo config: only a pre-existing warning on an untouched line.
  • Local docker buildx build -f test/e2e/docker/Dockerfile . succeeds. The image has no /src/tenderdash/.git, and go version -m /usr/bin/app shows unchanged build flags with no vcs.* stamping. A probe confirmed buildx 0.37 honours the per-Dockerfile ignore file.
  • Parallel subtests: gofmt/goimports clean. golangci-lint (repo config, new code only) reports 0 issues. make runner tests builds, and the tests binary lists the same 12 top-level tests as before.
  • Measured in CI on this PR (run with the cache warm, both legs green): "Build runner and tests" 92–99s → 4s; the test phase on rotate 93.3s → 50.6s (-46%); job totals rotate 1103–1286s → 1010s, dashcore 753–970s → 644s. The first run on a new cache key is a cold miss plus a ~10–20s save, as expected; the numbers above come from the run after it.
  • Note on reading the numbers: the "Run CI testnet" step varies by tens of seconds between runs (774s and 809s on the two runs here), so the test-phase duration above is measured directly from the run log rather than inferred from that step.
  • Watch: interleaved -test.v output, and rotate flake rate under the extra concurrent RPC load during the test phase.

Breaking changes

None. CI-only change.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests (n/a, CI config)
  • I have made corresponding changes to the documentation (n/a)

Prior work

🤖 Generated with Claude Code

…mage

Shorten the critical rotate leg of the e2e workflow without changing what
is tested:

- Run actions/setup-go after checkout so its module/build cache is keyed
  from repository files and actually restores (it never did: go.mod was
  not checked out yet). Use a dedicated key (go.sum, test/e2e/Makefile,
  BLS headers) instead of the go.mod hash shared with tests.yml and
  lint.yml, whose caches hold -race and lint artifacts. BLS headers are
  keyed because the Go build cache does not track cgo's C dependencies.
  Gate it like the other build steps.
- Export the GHA docker layer cache from the dashcore leg only; both legs
  still read it.
- Exclude .git from the E2E image build context via a Dockerfile-specific
  ignore file. The root .dockerignore keeps .git: DOCKER/Dockerfile stamps
  the release version with `git describe`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: caa1c886-7e2c-404a-83f3-40d05e86f976

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

testNode ran every node subtest sequentially, so the e2e test phase grew
linearly with the node count (~93 s on the 13 stateful nodes of rotate).
Run them in parallel, capped at 4 via -test.parallel in the runner. That
bounds RPC load on 4-vCPU CI runners and matches their default GOMAXPROCS.

Coverage is unchanged: the same tests, nodes and assertions, and
top-level tests stay sequential.

- testNode calls t.Parallel() in each node subtest. Its doc comment now
  says the callback must use the ctx it is given (the caller's deferred
  cancel has already run) and treat captured data as read-only.
- TestApp_Tx guards its shared *rand.Rand with a mutex; it is not safe
  for concurrent use.

History: t.Parallel() was part of testNode originally. Upstream tendermint
#7516 (09aa100, "e2e: constrain test parallelism and reporting")
removed it together with adding -test.v and sorting nodes, without
stating a reason. #7523 (ac57896) then introduced the shared *rand.Rand
that relied on sequential subtests. Shared test state (testnet and block
caches, node sort) is only touched from parent test bodies, and node
subtests only read shared data.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The parallel node subtests were checked for data races by code review
only; a local -race run against a testnet could not be scheduled. Leave a
TODO in testNode so the check isn't forgotten.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

PR Hygiene

State: waiting-bots · commit 39eadcab3dacf5f931dee2a948946101a9376fe7

  • thepastaclaw final review missing for current head
  • Bot review threads remain unresolved

Self-review is an author attestation for this exact commit:
/self-reviewed 39eadcab3dacf5f931dee2a948946101a9376fe7

This report does not bypass CI or repository protection rules.

@lklimek
lklimek marked this pull request as ready for review September 14, 2026 08:18
@lklimek
lklimek requested a review from shumkov as a code owner September 14, 2026 08:18
@thepastaclaw

thepastaclaw commented Sep 14, 2026 •

Copy link
Copy Markdown

🕓 Queued for automated review — 1st in line, estimated start in ~10 min (commit 39eadca)
Estimated review time once started: ~15 min (two-phase automated review; median of recent runs).

  • Request priority review — tick this box and the review moves to the front of the queue.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

The CI and E2E parallelization changes appear functionally sound and aligned with the stated goal. The new comment in the parallel subtest uses a TODO marker, which violates the repository’s explicit style rule prohibiting TODO comments; replace it with an issue reference or remove it after validation.

💬 1 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: general); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

  • Triage: normal by gpt-6-astra (effort low) — The diff makes cross-cutting CI, Docker build-context, and concurrent end-to-end test-runner changes that require validating cache behavior and test isolation, but it does not alter a critical surface such as consensus, funds, cryptography, networking deserialization, or storage migration.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 11% left, 5h 100% left), glm-5.3-flash (zai below 15% reserve: 5h 100% left, weekly 13% left)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `test/e2e/tests/e2e_test.go`:
- [NITPICK] test/e2e/tests/e2e_test.go:74-77: Remove the newly added TODO comment
  The project instructions explicitly prohibit TODO markers and require follow-up work to be tracked in an issue instead. This newly added comment documents an unfinished race-validation step for the concurrency change, so it should either be removed after race-enabled validation or rewritten to reference a concrete issue without using the TODO marker.

Comment thread test/e2e/tests/e2e_test.go Resolved
@lklimek
lklimek merged commit 6681860 into v1.8-dev Sep 14, 2026
21 of 23 checks passed
@lklimek
lklimek deleted the chore/e2e-ci-speedup branch September 14, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants