Skip to content

test!: consolidate integration tests into eight binaries - #346

Merged
patrickleet merged 1 commit into
v5from
refactor/v5-review-27c-test-binaries
Nov 25, 2026
Merged

patrickleet merged 1 commit into
v5from
refactor/v5-review-27c-test-binaries

Conversation

@patrickleet

Copy link
Copy Markdown
Collaborator

Task 27 stage C: consolidate integration tests into about eight binaries, and give uncached CI jobs rust-cache.

What changed

The root crate's 81 integration-test targets are now 8 binaries. Each former target is a module of its group, so cargo test --test <name> becomes cargo test --test <group> <name>::.

Group Former targets
core (14) aggregate_command, aggregate_less_commands, application_composition, causal_public_invoke, causal_wait_path, core_command_contract, replay_event_version, replay_property, snapshots, sourced, sourced_snapshot, sourced_upcasting, typed_commands, upcasting
repositories (15) aggregate_schedules, coordination_lease, durable_enqueue_sqlite, event_store, in_memory/sqlite/postgres repository conformance, postgres_repository, sqlite_repository, queued_repo, repository_api, schedule_worker, scheduled_outbox, snapshot_sqlite_hardening, sql_lock_manager
read_models (10) distributed_read_model(board), domain_event_projection_server, named_read_models, read_model*
graphql (16) every graphql_* target, including the three OIDC providers
gateway (8) edge_query_delivery(postgres), gateway*
transports (9) kafka, nats, rabbitmq, postgres and sqlite transports, redis_streams, transport_in_memory, transport_typed_commands, knative_cloudevents
services (7) bomberman, celld, e2e_ui_celld_nats_profile, microsvc, saga_transfer, sagas, todos
observability (2) metrics_exposition, otel_export
  • Test binaries: distributed goes from 82 to 9 (8 groups plus unit tests); the whole workspace goes from 132 to 59.
  • Relink time: after touch src/lib.rs, from 57.7 s to about 13 s.
  • Tests: 2,277 before and after, identical name for name once the module prefix is stripped.
  • Process-global state: audited.
    • The metrics recorder is global, and metrics_exposition asserts exact counts. It shares its binary only with otel_export, which records no metrics.
    • otel_export uses a thread-local subscriber (set_default).
    • No test sets env vars, installs a global subscriber, or uses ctor or serial_test. Servers bind port 0, and broker names and schemas are unique per test.
  • CI: every --test invocation in the workflows, the Makefiles and the scripts is rewritten. Each job was listed with --list before and after, and selects exactly the same tests. For example, the gateway GraphQL job goes from 7 --test targets to --test gateway --test graphql --test repositories with module filters, 85 = 85 tests.
  • rust-cache: added to the rust.yml coverage job, the only Rust job without it.
  • Feature gate: graphql_query_protocol is now gated on gateway-graphql-native + sqlite. Its load module never compiled without the native gateway.
  • Shared gateway sources: six gateway files are also compiled standalone by tests/gateway-portable and tests/gateway-native. They keep their own #![cfg], and gateway_support is loaded with #[path] so it resolves in both builds.

Breaking (test-only): integration test target names changed.

Verification (local)

  • cargo test -p distributed --all-features -- --list: 2,277 tests, the same as v5.
  • make test-local (Postgres plus compose services): 2,858 passed, 0 failed.
  • cargo test -p distributed --all-features with no services: all pass.
  • cargo check --workspace --all-targets --all-features: passes.
  • cargo check -p distributed --tests --no-default-features: passes, as does each of the 18 features alone.
  • Both gateway fixture crates (tests/gateway-portable, tests/gateway-native) pass their tests and clippy with -D warnings.
  • All workflow YAML parses.

Not done

  • docs/reviews/v5-pre-release/* still cite the old test paths. They are point-in-time review records.
  • gateway_support keeps #![allow(dead_code)], because the fixture crates include it file by file.
  • These warnings already exist and were left alone: FailingSerialize, unused archive, and unused imports in distributed_read_model and causal_wait_path. Three more appear in GraphQL modules because those now compile under feature combinations nobody built before.

The root crate built 81 integration test binaries, each relinking the
whole crate. They are now eight area binaries (core, repositories,
read_models, graphql, gateway, transports, services, observability);
each former target is a module, so `--test <name>` becomes
`--test <group> <name>::`. Same 2,277 tests, name for name.

Relinking after touching src/lib.rs drops from 57.7 s to about 13 s.
Process-global state was audited: the metrics recorder shares a binary
only with otel_export, which records none; no test sets env vars or a
global subscriber. Every CI and Makefile `--test` invocation is
rewritten and selects the same tests as before (listed per job in the
PR). The coverage job gets rust-cache.

graphql_query_protocol is gated on gateway-graphql-native, the feature
its load module always needed.

BREAKING CHANGE: integration test target names changed; use
`cargo test --test <group> <old_name>::`.

Implements [[tasks/v5-review-27]]
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5db4b9e0-02d9-4efa-a5a7-ebb716270f1b

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
  • 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

@patrickleet
patrickleet merged commit 0a984b3 into v5 Nov 25, 2026
27 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