Skip to content

ci: enable TUnit adaptive parallelism in CI - #1727

Merged
thomhurst merged 3 commits into
mainfrom
chore/tunit-adaptive-parallelism
Dec 3, 2026
Merged

thomhurst merged 3 commits into
mainfrom
chore/tunit-adaptive-parallelism

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Updates TUnit to 1.90.2 and turns on TUnit's experimental adaptive parallelism for the CI test step through TUNIT_ADAPTIVE_PARALLELISM=1. main was moved to 1.90.2 separately in #1728, so this PR now changes only the CI setting.

With adaptive parallelism, TUnit starts at its default limit (2x processor count) and raises or lowers the limit during the run based on throughput, CPU and memory pressure. The run summary prints one line per test project.

Local runs are unchanged. Set the same environment variable or pass --adaptive-parallelism to try it.

Manual throttles

None. Relayer has no [NotInParallel], [ParallelLimiter] or semaphore throttles in its tests, so there was nothing to remove.

Result: no measurable change

Test step, seconds. Three rounds, each with this branch (adaptive) and main (fixed limit) running at the same time on 1.90.2:

Round Adaptive net10.0 / net11.0 Fixed net10.0 / net11.0
1 278 / 402 314 / 371
2 389 / 351 293 / 389
3 277 / 265 251 / 393
Sum 1962 2011

The 2.5% difference is inside runner noise. The summaries show why: the runner's CPUs are saturated for most of the run, mostly by the database and broker containers, so a higher limit has nothing to use. The limit stayed at 8 in 101 of 108 test processes.

Two existing tests are timing-sensitive under load. They are unrelated to the mode:

  • Bounded_stop_cancels_a_stuck_handler_and_restart_replays_from_it: 200 ms stop deadline, failed once with adaptive mode on.
  • ChangeCaptureTests.Failed_send_stays_durable_after_checkpoint_and_restart_recovers_without_new_insert: timed out once with a fixed limit.

Details: thomhurst/TUnit#7915 (comment)

Per-message cost: none (test infrastructure only). No docs impact.

…in CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa6b58ad-49b5-4bc2-bf89-7135f7735edb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

Reviewed the head. The change is small and CI-only: it bumps TUnit 1.87.12 to 1.90.0 in Directory.Packages.props and sets TUNIT_ADAPTIVE_PARALLELISM=1 on the CI Test step.

  • No stale references to 1.87.12 remain in the repo.
  • It uses TUnit's native adaptive parallelism and adds no [ParallelLimiter] or [NotInParallel], so it fits the AGENTS.md rule against concurrency throttles.
  • It has no per-message cost and no docs impact, and the PR body says both.
  • The setting is scoped to CI, so local runs are unchanged.

Two non-blocking notes:

  • The feature is experimental. If the step turns flaky, I'd suggest reading the run summary's limit changes first, and removing the env var if it doesn't help.
  • The PR body promises a CI measurement comment. Please add it once the runs finish.

@thomhurst

Copy link
Copy Markdown
Owner Author

CI test-time comparison

Test step duration per framework leg, from two workflow_dispatch CI runs of this branch:

Run net10.0 net11.0
46415606150 248 s 307 s
46417456991 415 s 357 s

Baseline (last 8 successful main runs, 16 legs): 250–394 s, median about 365 s.

The branch median (332 s) is lower, but every result is inside the baseline range, and one leg (415 s) is slower than any baseline leg. With two runs on noisy hosted runners, this is no measurable improvement.

Likely reasons:

  • Most of the suite's time is broker and database containers. TUnit does not count container CPU when it decides whether to lower the limit, and it raises the limit only when throughput improves.
  • A local run's adaptive summary said the limit stayed at its start value because fewer tests were ready than the limit allowed. The fixed limit does not appear to be the bottleneck.

The adaptive summary does not appear in the CI log, because dotnet test over many projects does not print each test process's output. Running a test project directly (dotnet run --project tests/Relayer.Tests -- --adaptive-parallelism) prints it.

@github-actions

Copy link
Copy Markdown

Reviewed the diff: a TUnit bump in Directory.Packages.props plus TUNIT_ADAPTIVE_PARALLELISM=1 on the CI Test step.

  • No code or per-message path is touched, and no concurrency limiter is added, so this fits AGENTS.md.
  • The env var is scoped to CI, so local runs are unchanged.
  • Nit, not blocking: the title and description say 1.90.0, but the diff pins 1.90.1. Align one with the other.
  • Adaptive parallelism is experimental. If the measurement comment shows tests going flaky, treat that as a lead to investigate. Don't add a throttle.

@thomhurst thomhurst changed the title chore(tests): update TUnit to 1.90.0 and enable adaptive parallelism in CI chore(tests): update TUnit to 1.90.1 and enable adaptive parallelism in CI Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Review

The change is small and fits the repo rules. It touches only the test infrastructure. TUnit is the only package bumped. The adaptive-parallelism switch is a native TUnit feature, enabled only in the CI Test step through an environment variable. It adds no [NotInParallel] or limiter, so it complies with the 'no concurrency throttle' rule. There is no per-message impact and no docs impact.

Findings (non-blocking):

  • Version mismatch. The title says 1.90.1, the description says 1.90.0, and Directory.Packages.props pins 1.90.2. Make these match so the history and release notes stay accurate.
  • Experimental feature on the merge gate. Adaptive parallelism may change test timing on CI. If a new flake appears, investigate it as a real isolation problem rather than turning the flag off or rerunning. The PR description promises CI results, so post them before marking ready. The first run should also confirm that the 1.90.x bump alone doesn't change behavior.

@thomhurst thomhurst changed the title chore(tests): update TUnit to 1.90.1 and enable adaptive parallelism in CI ci: enable TUnit adaptive parallelism in CI Dec 1, 2026
@thomhurst
thomhurst marked this pull request as ready for review December 3, 2026 18:01
@thomhurst
thomhurst enabled auto-merge (squash) December 3, 2026 18:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T18:03:22.952590Z 97de129 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@thomhurst
thomhurst merged commit 2b96189 into main Dec 3, 2026
55 of 62 checks passed
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