Skip to content

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

Merged
ndbroadbent merged 7 commits into
mainfrom
ci/app-tests-one-binary
Dec 4, 2026
Merged

ndbroadbent merged 7 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 #694 · 510 unchanged · no changes

This PR vs base: 32 changed, 118 added since #425, across 6 builds

docspring/visualci · journeys · build #692 · 50 unchanged · no changes

This PR vs base: 6 changed, 20 added since #401, across 10 builds

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

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 8a448db to 2d72bfa Compare December 4, 2026 12:39
@ndbroadbent
ndbroadbent merged commit 8d38af4 into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the ci/app-tests-one-binary branch December 4, 2026 12:48
ndbroadbent added a commit that referenced this pull request Dec 4, 2026
…hat it answered

Since #176 put every integration test in one binary, baselines' five upload tests sometimes fail together on CI
(runs 47362577655, 47345661986, main ef8a7a9), all at baselines.rs:137, within a second of each other, about 10 s
into the run, while other uploads in the same run pass. The assert didn't print the status, so the cause is unknown,
and it doesn't reproduce locally (6 full runs, fresh RustFS, 100 concurrent PUTs to one key with DELETEs mixed in).

The helper now PUTs as the CLI does (client.rs retryable: 429 and 5xx tried again, each retry printed) and fails
with the URL, status and body otherwise, so a 4xx cause shows itself on the next failure.
ndbroadbent added a commit that referenced this pull request Dec 4, 2026
…s answer (#211)

* baselines tests: retry the store's 429/5xx as the CLI does, and say what it answered

Since #176 put every integration test in one binary, baselines' five upload tests sometimes fail together on CI
(runs 47362577655, 47345661986, main ef8a7a9), all at baselines.rs:137, within a second of each other, about 10 s
into the run, while other uploads in the same run pass. The assert didn't print the status, so the cause is unknown,
and it doesn't reproduce locally (6 full runs, fresh RustFS, 100 concurrent PUTs to one key with DELETEs mixed in).

The helper now PUTs as the CLI does (client.rs retryable: 429 and 5xx tried again, each retry printed) and fails
with the URL, status and body otherwise, so a 4xx cause shows itself on the next failure.

* baselines tests: each test's images get bytes of their own (a tEXt nonce, same pixels); jittered backoff like the CLI

Every test built the identical 8x6 PNGs, so with all tests in one binary, baselines (and gallery, retention,
project_deletion) wrote and verified the same blobs/<sha256> at once. A per-World nonce in a tEXt chunk keeps the
pixels and fingerprints and gives each test its own key. Retries now wait 0.5 s doubling plus up to half again at
random, 6 tries, as the CLI does.
ndbroadbent added a commit that referenced this pull request Dec 4, 2026
…e since #176)

The baselines flake's cause, printed by #211's diagnostic on main 40dcc92: HTTP 404 NoSuchBucket. In one test
binary, baselines' tests all create the bucket at once on a fresh RustFS; one gets 409 while another's create is in
progress, and its upload then finds no bucket. ensure_bucket now polls HEAD bucket until it answers (up to 10 s).
ndbroadbent added a commit that referenced this pull request Dec 4, 2026
…e since #176) (#217)

The baselines flake's cause, printed by #211's diagnostic on main 40dcc92: HTTP 404 NoSuchBucket. In one test
binary, baselines' tests all create the bucket at once on a fresh RustFS; one gets 409 while another's create is in
progress, and its upload then finds no bucket. ensure_bucket now polls HEAD bucket until it answers (up to 10 s).
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