Skip to content

app tests: one test binary instead of 53 - #176

Open
ndbroadbent wants to merge 5 commits into
mainfrom
ci/app-tests-one-binary
Open

ndbroadbent wants to merge 5 commits into
mainfrom
ci/app-tests-one-binary

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

The app job's cargo test step took 145–233 s in recent runs: about 131 s compiling and linking, then about 74 s running 53 test binaries one after another (run 47272907438).

  • app/tests/all.rs declares every test file as a module, and app/Cargo.toml sets autotests = false with one [[test]] for it. The shared helpers golden and oauth_client are declared once there, and the files that used them use crate::… instead.
  • live_limits, mcp_hosts and proxies keep their own binaries: each says it needs its own process (a per-process counter, or the MCP service built from the first test's settings).
  • every_test_file_is_listed fails if a file in tests/ is in neither list, so a new test file can't silently stop running.
  • One file now runs with cargo test -p visualci-app <file>::. Nothing in the repo used --test <file>.

I checked the other process-wide statics for problems across files: the /mcp and admin MCP services, the Stripe catalog, the live hub and the gallery cache. Within each file they were already shared, and the only file that depends on host settings (mcp_hosts) stays separate. hosts.rs and sign_in.rs expect only the host check's 404, which runs before the service is built.

Checked on the build pool: clippy --all-targets -D warnings is clean. The full app suite passed three times in a row, with 302 tests in the shared binary in 32–38 s (after the rebase), plus the three separate binaries.

Before and after, measured on what this is for: a PR that changes app/src. I ran the same one-line change twice with workflow_dispatch, once on main and once on this branch:

compile and link tests cargo test step
main (53 binaries), run 47282226814 123 s 105 s 228 s
this PR (one binary), run 47282230947 70 s 75 s 145 s (−36%)

On a PR that doesn't touch app/src it changes little (149 s against 145–154 s), because rust-cache already has the test binaries. I also tried RUST_TEST_THREADS=12: the tests took 73 s against 75 s, so I reverted it.

Also from the review: main had gained three test files, now listed. live.rs gets its own binary, because its listener test needs to start first, which only alphabetical order guaranteed. The guard now fails if a file is listed twice.

@visualci-com

visualci-com Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #477 · 8 added, 392 unchanged · waiting for review

This PR vs base: 10 changed, 8 added since #425, across 3 builds · 8 not approved yet

Snapshot Before After
screenshots/blog/index/1440-dark (added) –
screenshots/blog/index/1440-light (added) –
screenshots/blog/index/390-dark (added) –
screenshots/blog/index/390-light (added) –
screenshots/blog/post/1440-dark (added) –
screenshots/blog/post/1440-light (added) –
screenshots/blog/post/390-dark (added) –
screenshots/blog/post/390-light (added) –

docspring/visualci · journeys · build #499 · 42 unchanged · no changes

This PR vs base: 6 changed, 12 added since #401, across 5 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent force-pushed the ci/app-tests-one-binary branch from 17b9fb7 to 6d3623b Compare December 4, 2026 06:05
Each file in app/tests was its own test binary: every run linked the whole app 53 times, then cargo ran the binaries
one after another. They're now modules of tests/all.rs, linked once, with every test running in parallel (Laravel Rust
gives each test its own application and database). live_limits, mcp_hosts and proxies say they need a process of
their own, so they stay separate [[test]] targets. A test fails if a file in tests/ is in neither list, since
autotests is off.
…binary; guard requires exactly one listing

From the review: main gained three test files; live.rs must start the live-updates listener on its own runtime,
which only alphabetical order guaranteed in the shared binary; and a file listed in both places would run twice.
The tests are bound by the runner after all, so more threads only meant more database copies.
@ndbroadbent
ndbroadbent force-pushed the ci/app-tests-one-binary branch from 03b283b to 2538f84 Compare December 4, 2026 07:08

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant