diff --git a/.github/workflows/integration-celld.yaml b/.github/workflows/integration-celld.yaml index 1b75c98cf..260c82cff 100644 --- a/.github/workflows/integration-celld.yaml +++ b/.github/workflows/integration-celld.yaml @@ -193,9 +193,8 @@ jobs: cargo build -p distributed_cli --bin distributed target/debug/distributed build tests/e2e-ui --output json target/debug/distributed build tests/e2e-celld --output json - cargo test --test celld --no-run - cargo test --test e2e_ui_celld_nats_profile \ - --features graphql,http,sqlite --no-run + cargo test --test services --no-run + cargo test --test services --features graphql,http,sqlite --no-run npm install --prefix tests/e2e-ui # celld dev watches its project for rebuilds. Complete browser/toolchain diff --git a/.github/workflows/integration-e2e-ui.yaml b/.github/workflows/integration-e2e-ui.yaml index 6ad34a5dc..30ac3576b 100644 --- a/.github/workflows/integration-e2e-ui.yaml +++ b/.github/workflows/integration-e2e-ui.yaml @@ -155,7 +155,7 @@ jobs: npx playwright install chromium --with-deps - name: Verify candidate-key SSR and live delivery end to end - run: cargo test --manifest-path ../../Cargo.toml --features graphql,sqlite --test graphql_unique_key_live projected_candidate_keys_reach_chromium_over_http_and_websocket -- --ignored --exact --nocapture + run: 'cargo test --manifest-path ../../Cargo.toml --features graphql,sqlite --test graphql graphql_unique_key_live::projected_candidate_keys_reach_chromium_over_http_and_websocket -- --ignored --exact --nocapture' - name: Run browser e2e run: | diff --git a/.github/workflows/integration-game-demos.yaml b/.github/workflows/integration-game-demos.yaml index 15ddf8747..253b328d8 100644 --- a/.github/workflows/integration-game-demos.yaml +++ b/.github/workflows/integration-game-demos.yaml @@ -83,7 +83,7 @@ jobs: - name: Redis Streams publisher against real Redis env: REDIS_URL: redis://127.0.0.1:6379 - run: cargo test --features redis-streams --test redis_streams -- --nocapture + run: 'cargo test --features redis-streams --test transports redis_streams:: -- --nocapture' - name: Ticket rate limiter against real Redis working-directory: js env: diff --git a/.github/workflows/integration-gateway.yaml b/.github/workflows/integration-gateway.yaml index ef437c43b..2225bac21 100644 --- a/.github/workflows/integration-gateway.yaml +++ b/.github/workflows/integration-gateway.yaml @@ -42,7 +42,7 @@ jobs: save-if: ${{ github.event_name != 'pull_request' }} - name: Format contract and fixture sources if: ${{ !cancelled() }} - run: rustfmt --edition 2021 --check src/gateway/mod.rs tests/gateway_routing.rs tests/gateway_extensions.rs tests/gateway-portable/src/lib.rs + run: rustfmt --edition 2021 --check src/gateway/mod.rs tests/gateway/gateway_routing.rs tests/gateway/gateway_extensions.rs tests/gateway-portable/src/lib.rs - name: Test portable routing and adapter contracts if: ${{ !cancelled() }} run: cargo test --manifest-path tests/gateway-portable/Cargo.toml --locked @@ -84,7 +84,7 @@ jobs: shared-key: graphql save-if: false - name: Verify gateway and backend identity - run: cargo test -p distributed --no-default-features --features gateway,graphql,sqlite --test graphql_identity + run: 'cargo test -p distributed --no-default-features --features gateway,graphql,sqlite --test graphql graphql_identity::' - name: Install pinned auth fixture dependencies working-directory: tests/gateway-auth run: npm ci @@ -113,7 +113,7 @@ jobs: shared-key: gateway-graphql save-if: false - name: Verify embedded and remote GraphQL protocols - run: cargo test -p distributed --no-default-features --features gateway-graphql-native,sqlite --test gateway_graphql --test gateway_graphql_operation --test graphql_causal_transport --test graphql_query_protocol --test graphql_identity --test graphql_sqlite --test sqlite_repository + run: 'cargo test -p distributed --no-default-features --features gateway-graphql-native,sqlite --test gateway --test graphql --test repositories -- gateway_graphql:: gateway_graphql_operation:: graphql_causal_transport:: graphql_query_protocol:: graphql_identity:: graphql_sqlite:: sqlite_repository::' - name: Verify the portable delivery state machines and WS codec run: 'cargo test -p distributed --no-default-features --features gateway --lib gateway::' @@ -193,14 +193,14 @@ jobs: node tests/gateway-worker/proxy-runtime.mjs node tests/gateway-worker/run.mjs - name: Measure actual native and workerd origin/client savings - run: cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql_query_protocol separate_origin_and_client_savings -- --ignored --nocapture + run: 'cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql graphql_query_protocol::load::separate_origin_and_client_savings -- --ignored --nocapture' - uses: actions/upload-artifact@v4 if: always() with: name: gateway-delivery-load path: tests/gateway-worker/artifacts/load-report.json - name: Prove actual DO coordination, SQL reduction, restart and cancellation - run: cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql_query_protocol worker_ -- --ignored --nocapture --test-threads=1 + run: 'cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql graphql_query_protocol::worker_ -- --ignored --nocapture --test-threads=1' application: runs-on: ubuntu-latest @@ -234,7 +234,7 @@ jobs: cd tests/gateway-auth npx playwright install --with-deps chromium - name: Verify application composition - run: cargo test --no-default-features --features graphql,sqlite,gateway --test application_composition + run: 'cargo test --no-default-features --features graphql,sqlite,gateway --test core application_composition::' - name: Build coherent application and run public-origin browser flows run: node tests/e2e-ui/gateway/run.mjs - name: Verify dev lifecycle and browser flows through the gateway diff --git a/.github/workflows/integration-graphql.yaml b/.github/workflows/integration-graphql.yaml index 1e17018f8..0eb978cd5 100644 --- a/.github/workflows/integration-graphql.yaml +++ b/.github/workflows/integration-graphql.yaml @@ -10,7 +10,7 @@ name: GraphQL Identity / OIDC Integration Tests # Local parity: # ./scripts/oidc-{zitadel,keycloak,authentik}-up.sh # set -a && source graphql-oidc[-keycloak|-authentik].env && set +a -# cargo test --test graphql_oidc_ --features graphql,sqlite,metrics +# cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_:: on: workflow_call: @@ -44,7 +44,7 @@ jobs: save-if: ${{ github.event_name != 'pull_request' }} - name: Always-on identity suite (no IdP) run: | - cargo test --test graphql_identity --features graphql,sqlite,metrics --verbose + cargo test --test graphql --features graphql,sqlite,metrics --verbose graphql_identity:: oidc-zitadel-e2e: name: GraphQL OIDC Zitadel e2e (live) @@ -79,16 +79,16 @@ jobs: test -n "${OIDC_ISSUER:-}" test -n "${GRAPHQL_E2E_CUSTOMER_KEY:-}" echo "ZITADEL_E2E=$ZITADEL_E2E OIDC_ISSUER=$OIDC_ISSUER" - cargo test --test graphql_oidc_zitadel --features graphql,sqlite,metrics --verbose -- --nocapture + cargo test --test graphql --features graphql,sqlite,metrics --verbose graphql_oidc_zitadel:: -- --nocapture - name: Dump Zitadel logs on failure if: failure() run: | - docker compose -f tests/graphql_oidc_zitadel/docker-compose.yml ps -a || true - docker compose -f tests/graphql_oidc_zitadel/docker-compose.yml logs --tail=200 || true - ls -la tests/graphql_oidc_zitadel/machinekey || true + docker compose -f tests/graphql/graphql_oidc_zitadel/docker-compose.yml ps -a || true + docker compose -f tests/graphql/graphql_oidc_zitadel/docker-compose.yml logs --tail=200 || true + ls -la tests/graphql/graphql_oidc_zitadel/machinekey || true - name: Tear down if: always() - run: docker compose -f tests/graphql_oidc_zitadel/docker-compose.yml down -v || true + run: docker compose -f tests/graphql/graphql_oidc_zitadel/docker-compose.yml down -v || true oidc-keycloak-e2e: name: GraphQL OIDC Keycloak e2e (live) @@ -120,15 +120,15 @@ jobs: test -n "${KEYCLOAK_E2E:-}" test -n "${OIDC_ISSUER:-}" echo "KEYCLOAK_E2E=$KEYCLOAK_E2E OIDC_ISSUER=$OIDC_ISSUER OIDC_AUDIENCE=$OIDC_AUDIENCE" - cargo test --test graphql_oidc_keycloak --features graphql,sqlite,metrics --verbose -- --nocapture + cargo test --test graphql --features graphql,sqlite,metrics --verbose graphql_oidc_keycloak:: -- --nocapture - name: Dump Keycloak logs on failure if: failure() run: | - docker compose -f tests/graphql_oidc_keycloak/docker-compose.yml ps -a || true - docker compose -f tests/graphql_oidc_keycloak/docker-compose.yml logs --tail=200 || true + docker compose -f tests/graphql/graphql_oidc_keycloak/docker-compose.yml ps -a || true + docker compose -f tests/graphql/graphql_oidc_keycloak/docker-compose.yml logs --tail=200 || true - name: Tear down if: always() - run: docker compose -f tests/graphql_oidc_keycloak/docker-compose.yml down -v || true + run: docker compose -f tests/graphql/graphql_oidc_keycloak/docker-compose.yml down -v || true oidc-authentik-e2e: name: GraphQL OIDC Authentik e2e (live) @@ -161,12 +161,12 @@ jobs: test -n "${OIDC_ISSUER:-}" test -n "${OIDC_JWKS_URI:-}" echo "AUTHENTIK_E2E=$AUTHENTIK_E2E OIDC_ISSUER=$OIDC_ISSUER" - cargo test --test graphql_oidc_authentik --features graphql,sqlite,metrics --verbose -- --nocapture + cargo test --test graphql --features graphql,sqlite,metrics --verbose graphql_oidc_authentik:: -- --nocapture - name: Dump Authentik logs on failure if: failure() run: | - docker compose -f tests/graphql_oidc_authentik/docker-compose.yml ps -a || true - docker compose -f tests/graphql_oidc_authentik/docker-compose.yml logs --tail=200 || true + docker compose -f tests/graphql/graphql_oidc_authentik/docker-compose.yml ps -a || true + docker compose -f tests/graphql/graphql_oidc_authentik/docker-compose.yml logs --tail=200 || true - name: Tear down if: always() - run: docker compose -f tests/graphql_oidc_authentik/docker-compose.yml down -v || true + run: docker compose -f tests/graphql/graphql_oidc_authentik/docker-compose.yml down -v || true diff --git a/.github/workflows/integration-observability.yaml b/.github/workflows/integration-observability.yaml index 0fa434005..00c9a0781 100644 --- a/.github/workflows/integration-observability.yaml +++ b/.github/workflows/integration-observability.yaml @@ -60,7 +60,7 @@ jobs: run: | mkdir -p target/otel-out && chmod 777 target/otel-out docker run -d --user 0 --name otelcol -p 4318:4318 -p 4317:4317 \ - -v "$PWD/tests/otel_export/collector-config.yaml:/etc/otelcol/config.yaml:ro" \ + -v "$PWD/tests/observability/otel_export/collector-config.yaml:/etc/otelcol/config.yaml:ro" \ -v "$PWD/target/otel-out:/out" \ otel/opentelemetry-collector:0.116.1 --config /etc/otelcol/config.yaml for i in $(seq 1 30); do @@ -76,14 +76,14 @@ jobs: env: PROMTOOL: /usr/local/bin/promtool DISTRIBUTED_REQUIRE_SERVICES: PROMTOOL - run: cargo test --test metrics_exposition --features http,metrics --verbose + run: 'cargo test --test observability --features http,metrics --verbose metrics_exposition::' - name: Run OTLP export tests if: ${{ !cancelled() }} env: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://localhost:4318/v1/traces OTEL_COLLECTOR_TRACES_FILE: ${{ github.workspace }}/target/otel-out/traces.json DISTRIBUTED_REQUIRE_SERVICES: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,OTEL_COLLECTOR_TRACES_FILE - run: cargo test --test otel_export --features http,otel --verbose + run: 'cargo test --test observability --features http,otel --verbose otel_export::' - name: Scaffold service with metrics and tracing if: ${{ !cancelled() }} run: | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bc649fdf8..3592cbd5e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,6 +17,10 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: llvm-tools-preview + - uses: Swatinem/rust-cache@v2 + with: + shared-key: coverage + save-if: ${{ github.event_name != 'pull_request' }} - uses: taiki-e/install-action@cargo-llvm-cov # --all-features compiles rdkafka; librdkafka's bundled cmake build needs # curl/curl.h (the runner has libcurl's runtime but not its headers). diff --git a/.gitignore b/.gitignore index 3615c9746..686521539 100644 --- a/.gitignore +++ b/.gitignore @@ -46,8 +46,8 @@ graphql-oidc.env graphql-oidc.env graphql-oidc-keycloak.env graphql-oidc-authentik.env -tests/graphql_oidc_zitadel/machinekey/** -!tests/graphql_oidc_zitadel/machinekey/.gitignore +tests/graphql/graphql_oidc_zitadel/machinekey/** +!tests/graphql/graphql_oidc_zitadel/machinekey/.gitignore tests/workshop-service/ui/node_modules/ tests/workshop-service/ui/build/ tests/workshop-service/ui/.svelte-kit/ diff --git a/Cargo.toml b/Cargo.toml index 766aa3a9a..fd6415920 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,7 @@ tower = { version = "0.5", features = ["util"] } http-body-util = "0.1" # Names the level SQLx logs statements at (src/sqlx_repo/statement_count_tests.rs). log = "0.4" -# OTLP export e2e (tests/otel_export): a real SDK pipeline pointed at a +# OTLP export e2e (tests/observability/otel_export): a real SDK pipeline pointed at a # collector container, exercising the `otel` feature the way a service binary # would. Keep versions in lockstep with the optional `otel` feature deps. opentelemetry-otlp = { version = "0.32", default-features = false, features = ["trace", "http-proto", "reqwest-blocking-client"] } diff --git a/README.md b/README.md index f743cf5cf..c3361af80 100644 --- a/README.md +++ b/README.md @@ -567,13 +567,13 @@ claim → role/session). Live against three local IdPs — not mocks only: | Provider | Compose + bootstrap | Live test | Gate | |---|---|---|---| -| **[Zitadel](tests/graphql_oidc_zitadel/)** (reference) | `./scripts/oidc-zitadel-up.sh` | `cargo test --test graphql_oidc_zitadel --features graphql,sqlite` | `ZITADEL_E2E=1` | -| **[Keycloak](tests/graphql_oidc_keycloak/)** | `./scripts/oidc-keycloak-up.sh` | `cargo test --test graphql_oidc_keycloak --features graphql,sqlite` | `KEYCLOAK_E2E=1` | -| **[Authentik](tests/graphql_oidc_authentik/)** | `./scripts/oidc-authentik-up.sh` | `cargo test --test graphql_oidc_authentik --features graphql,sqlite` | `AUTHENTIK_E2E=1` | +| **[Zitadel](tests/graphql/graphql_oidc_zitadel/)** (reference) | `./scripts/oidc-zitadel-up.sh` | `cargo test --test graphql --features graphql,sqlite graphql_oidc_zitadel::` | `ZITADEL_E2E=1` | +| **[Keycloak](tests/graphql/graphql_oidc_keycloak/)** | `./scripts/oidc-keycloak-up.sh` | `cargo test --test graphql --features graphql,sqlite graphql_oidc_keycloak::` | `KEYCLOAK_E2E=1` | +| **[Authentik](tests/graphql/graphql_oidc_authentik/)** | `./scripts/oidc-authentik-up.sh` | `cargo test --test graphql --features graphql,sqlite graphql_oidc_authentik::` | `AUTHENTIK_E2E=1` | Shared **E1–E8** in [`tests/common/src/oidc.rs`](tests/common/src/oidc.rs). Gated binaries skip cleanly when unset. Offline: -`cargo test --test graphql_identity --features graphql,sqlite`. +`cargo test --test graphql --features graphql,sqlite graphql_identity::`. e2e-ui boots **Zitadel** for the browser path; the three stacks prove the same `OidcBearer` edge is not vendor-locked. @@ -899,7 +899,7 @@ renames. The handler must still obtain the principal from its authenticated session and enforce membership rules; this declaration only supplies the generated preview's provenance. -See [the executable contract tests](tests/sourced/flat_preview.rs), including +See [the executable contract tests](tests/core/sourced/flat_preview.rs), including the generated delete-projection client, helper replay and conflicting/dynamic-value cases. ### Durable Stream Identity @@ -1477,7 +1477,7 @@ impl Crawler { The generated registration is exactly the hand-written one (`command_transition::(name)` + `field_name`, `roles`, `guarded`/`handle`): the command specs, GraphQL SDL and client -manifest are identical (`tests/aggregate_command`). For unusual bodies write +manifest are identical (`tests/core/aggregate_command`). For unusual bodies write the handler and register it with `command! { .., handle: f }` or the builder below. @@ -2137,9 +2137,9 @@ Scaffolds prefer **`OidcBearer`** whenever OIDC env is set — not DevHeaders. **Provider-portable by design.** Live compose + bootstrap + e2e binaries ship for: -- **Zitadel** — `tests/graphql_oidc_zitadel` + `scripts/oidc-zitadel-up.sh` (JWT-bearer mint; also powers e2e-ui login) -- **Keycloak** — `tests/graphql_oidc_keycloak` + `scripts/oidc-keycloak-up.sh` (client_credentials + realm roles) -- **Authentik** — `tests/graphql_oidc_authentik` + `scripts/oidc-authentik-up.sh` (client_credentials + groups) +- **Zitadel** — `tests/graphql/graphql_oidc_zitadel` + `scripts/oidc-zitadel-up.sh` (JWT-bearer mint; also powers e2e-ui login) +- **Keycloak** — `tests/graphql/graphql_oidc_keycloak` + `scripts/oidc-keycloak-up.sh` (client_credentials + realm roles) +- **Authentik** — `tests/graphql/graphql_oidc_authentik` + `scripts/oidc-authentik-up.sh` (client_credentials + groups) Shared assertions (E1–E8): discovery/JWKS, happy path, role isolation, multi-audience / `azp`, expired and forged tokens, etc. Generic OIDC also works for SaaS IdPs (e.g. Okta) without a dedicated compose stack. @@ -2283,22 +2283,22 @@ See [`js/README.md`](js/README.md) for package API and packaging. | Suite | Focus | |---|---| -| `tests/graphql_*` | Engine, HTTP, SDL, dialects, harden (authz/DoS/inject), causal transport | -| `tests/graphql_identity` | Always-on OIDC/JWT matrix (mock JWKS; no Docker) | -| `tests/graphql_oidc_{zitadel,keycloak,authentik}` | **Live** multi-IdP e2e (compose + real JWKS; gated) | -| `tests/typed_commands` | Eventual / Atomic / Succeeded command registration | +| `tests/graphql/` | Engine, HTTP, SDL, dialects, harden (authz/DoS/inject), causal transport | +| `tests/graphql/graphql_identity` | Always-on OIDC/JWT matrix (mock JWKS; no Docker) | +| `tests/graphql/graphql_oidc_{zitadel,keycloak,authentik}` | **Live** multi-IdP e2e (compose + real JWKS; gated) | +| `tests/core/typed_commands` | Eventual / Atomic / Succeeded command registration | | `tests/e2e-ui` | Multi-crate product template + SvelteKit + Zitadel UI login + Playwright | | `js/tests` | Replica, command runtime, adapters | | `examples/graphiql.rs` | Seeded local playground | ```bash -cargo test --test graphql_engine --features "graphql,sqlite" -cargo test --test graphql_identity --features "graphql,sqlite" -cargo test --test graphql_harden --features "graphql,sqlite" +cargo test --test graphql --features "graphql,sqlite" graphql_engine:: +cargo test --test graphql --features "graphql,sqlite" graphql_identity:: +cargo test --test graphql --features "graphql,sqlite" graphql_harden:: cd js && npm run quality # Live IdPs (optional): # ./scripts/oidc-zitadel-up.sh && set -a && source graphql-oidc.env && set +a -# cargo test --test graphql_oidc_zitadel --features graphql,sqlite +# cargo test --test graphql --features graphql,sqlite graphql_oidc_zitadel:: # Full UI matrix: cd tests/e2e-ui && make test ``` @@ -2723,14 +2723,14 @@ unset**; SQLite uses a temporary database file and needs no Docker service. docker compose up -d # postgres, rabbitmq, kafka, nats (see compose.yaml) DATABASE_URL=postgres://sourced:sourced@localhost:5432/distributed \ - cargo test --test postgres_transport --features postgres -cargo test --test sqlite_transport --features sqlite + cargo test --test transports --features postgres postgres_transport:: +cargo test --test transports --features sqlite sqlite_transport:: NATS_URL=nats://localhost:4222 \ - cargo test --test nats_transport --features nats + cargo test --test transports --features nats nats_transport:: AMQP_URL=amqp://guest:guest@localhost:5672/%2f \ - cargo test --test rabbitmq_transport --features rabbitmq + cargo test --test transports --features rabbitmq rabbitmq_transport:: KAFKA_BROKERS=127.0.0.1:9092 \ - cargo test --test kafka_transport --features kafka + cargo test --test transports --features kafka kafka_transport:: ``` Each external broker has a matching reusable GitHub Actions job @@ -2761,13 +2761,13 @@ e2e-celld (`tests/e2e-celld`), Blob game, live chat, GraphiQL. | [`tests/e2e-celld/`](tests/e2e-celld/) | Same UI; Todo + `chat.post` wait-dispatch to celld; `@live` stays on GraphQL | | [`js/`](js/) | `@hops-ops/distributed` — transport, causal replica, SvelteKit/React | | [`examples/graphiql.rs`](examples/graphiql.rs) | Seeded GraphQL playground (`--features "graphql,sqlite"`) | -| `tests/graphql_*` | Engine, HTTP/WS, harden, identity, multi-IdP OIDC | -| `tests/typed_commands/` | Eventual / `Atomic` / `Succeeded` command registration | -| `tests/microsvc/` | Handlers on HTTP, gRPC, bus, session | -| `tests/read_model_*/`, `tests/distributed_read_model/` | Read models: commit bridge, keyset scans, relationships, sessions, Atomic vs eventual projections | -| `tests/sourced*` / `tests/snapshots/` / `tests/upcasting/` | Macros, snapshots, event versioning | -| `tests/sagas/` | Orchestration + choreography with the outbox | -| `tests/*_transport/`, `tests/knative_cloudevents/` | Broker adapters + conformance | +| `tests/graphql/` | Engine, HTTP/WS, harden, identity, multi-IdP OIDC | +| `tests/core/typed_commands/` | Eventual / `Atomic` / `Succeeded` command registration | +| `tests/services/microsvc/` | Handlers on HTTP, gRPC, bus, session | +| `tests/read_models/` | Read models: commit bridge, keyset scans, relationships, sessions, Atomic vs eventual projections | +| `tests/core/sourced*` / `tests/core/snapshots/` / `tests/core/upcasting/` | Macros, snapshots, event versioning | +| `tests/services/sagas/` | Orchestration + choreography with the outbox | +| `tests/transports/` | Broker adapters + conformance | ## License diff --git a/compose.yaml b/compose.yaml index 0aebca267..5760aa090 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,13 +7,13 @@ # (each integration test skips when its env var is unset): # # DATABASE_URL=postgres://sourced:sourced@localhost:5432/distributed \ -# cargo test --test postgres_transport --features postgres +# cargo test --test transports --features postgres postgres_transport:: # AMQP_URL=amqp://guest:guest@localhost:5672/%2f \ -# cargo test --test rabbitmq_transport --features rabbitmq +# cargo test --test transports --features rabbitmq rabbitmq_transport:: # KAFKA_BROKERS=127.0.0.1:9092 \ -# cargo test --test kafka_transport --features kafka +# cargo test --test transports --features kafka kafka_transport:: # NATS_URL=nats://localhost:4222 \ -# cargo test --test nats_transport --features nats +# cargo test --test transports --features nats nats_transport:: # REDIS_URL=redis://127.0.0.1:6379 \ # cargo test -p distributed_leaderboard --features redis,graphql --test redis services: diff --git a/docs/coordination-primitives.md b/docs/coordination-primitives.md index 27f05dfea..0c36d68ae 100644 --- a/docs/coordination-primitives.md +++ b/docs/coordination-primitives.md @@ -222,7 +222,7 @@ ctx.outbox(reply).commit(aggregate)?.succeeded(payload) ``` (`rejected` maps a `SagaError` to `HandlerError::Rejected`; -`tests/saga_transfer/main.rs` is the complete participant.) +`tests/services/saga_transfer/mod.rs` is the complete participant.) `from_session` reads the saga headers, which arrive as session claims, and the saga command id, which the transport puts in `TRANSPORT_MESSAGE_ID_CLAIM`. @@ -315,7 +315,7 @@ bounds, and replay from a repository). ### Worked example -`tests/saga_transfer/main.rs` moves value between wallets in two separate +`tests/services/saga_transfer/mod.rs` moves value between wallets in two separate cells. The `debit` step goes to the source cell (compensated by `refund`) and the `credit` step goes to the target cell (compensated by `reverse_credit`). A test network delivers outbox rows whose `deliver_at` is due on a @@ -335,7 +335,7 @@ A test network delivers outbox rows whose `deliver_at` is due on a ## Tests ```sh -cargo test --features sqlite,postgres --test saga_transfer --test coordination_lease --test scheduled_outbox +cargo test --features sqlite,postgres --test services --test repositories -- saga_transfer:: coordination_lease:: scheduled_outbox:: cargo test --features sqlite --lib -- outbox lease clock cargo test --features cloudflare-workers --lib cell_host (cd tests/celld/alarm-worker && worker-build --release) && node tests/celld/alarms.mjs diff --git a/docs/gateway/metrics.md b/docs/gateway/metrics.md index 2ca48fefd..719e7b07a 100644 --- a/docs/gateway/metrics.md +++ b/docs/gateway/metrics.md @@ -15,7 +15,7 @@ Run the actual load fixture after installing `tests/gateway-worker` and worker-build as described in [worker.md](worker.md): ```sh -cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql_query_protocol separate_origin_and_client_savings -- --ignored --nocapture +cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql graphql_query_protocol::load::separate_origin_and_client_savings -- --ignored --nocapture ``` `tests/gateway-worker/load-runtime.mjs` writes its report to diff --git a/js/tests/replica-query-plan-corpus.test.mjs b/js/tests/replica-query-plan-corpus.test.mjs index 378eb40ee..00f9296c1 100644 --- a/js/tests/replica-query-plan-corpus.test.mjs +++ b/js/tests/replica-query-plan-corpus.test.mjs @@ -8,7 +8,7 @@ import { } from '../dist/replica/index.js'; // The shared statement of what a `where`, a row policy and an `order_by` -// mean. `tests/graphql_compile/main.rs` holds SQLite, Postgres and the Rust +// mean. `tests/graphql/graphql_compile/mod.rs` holds SQLite, Postgres and the Rust // evaluator to the same file, and checks `fields` against the manifest. const corpus = JSON.parse( await readFile( diff --git a/scripts/ci-bootstrap-graphql-oidc.sh b/scripts/ci-bootstrap-graphql-oidc.sh index 03070b0ff..e0f50ba21 100755 --- a/scripts/ci-bootstrap-graphql-oidc.sh +++ b/scripts/ci-bootstrap-graphql-oidc.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Bootstrap live Zitadel for GraphQL OIDC e2e (D11 JWT-bearer mint). -# Expects Zitadel from tests/graphql_oidc_zitadel/docker-compose.yml. +# Expects Zitadel from tests/graphql/graphql_oidc_zitadel/docker-compose.yml. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" -COMPOSE_DIR="$ROOT/tests/graphql_oidc_zitadel" +COMPOSE_DIR="$ROOT/tests/graphql/graphql_oidc_zitadel" MACHINEKEY_DIR="$COMPOSE_DIR/machinekey" ZITADEL_HOST="${ZITADEL_HOST:-http://localhost:8080}" OUT="${GRAPHQL_OIDC_ENV:-$ROOT/graphql-oidc.env}" diff --git a/scripts/oidc-authentik-up.sh b/scripts/oidc-authentik-up.sh index 2cd55db8a..e82bf96f9 100755 --- a/scripts/oidc-authentik-up.sh +++ b/scripts/oidc-authentik-up.sh @@ -3,7 +3,7 @@ # Pattern: compose up → wait healthy → docker exec bootstrap → write env. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" -COMPOSE="$ROOT/tests/graphql_oidc_authentik/docker-compose.yml" +COMPOSE="$ROOT/tests/graphql/graphql_oidc_authentik/docker-compose.yml" OUT="${GRAPHQL_OIDC_AUTHENTIK_ENV:-$ROOT/graphql-oidc-authentik.env}" BASE="${AUTHENTIK_URL:-http://localhost:9000}" AK_EMAIL="${AUTHENTIK_BOOTSTRAP_EMAIL:-akadmin@localhost}" @@ -340,4 +340,4 @@ EOF echo "==> Wrote $OUT" cat "$OUT" -echo "==> Done. source $OUT && cargo test --test graphql_oidc_authentik --features graphql,sqlite,metrics" +echo "==> Done. source $OUT && cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_authentik::" diff --git a/scripts/oidc-keycloak-up.sh b/scripts/oidc-keycloak-up.sh index ece8a6891..a7679e8f9 100755 --- a/scripts/oidc-keycloak-up.sh +++ b/scripts/oidc-keycloak-up.sh @@ -2,7 +2,7 @@ # Start Keycloak + write graphql-oidc-keycloak.env for e2e (local + CI). set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" -COMPOSE="$ROOT/tests/graphql_oidc_keycloak/docker-compose.yml" +COMPOSE="$ROOT/tests/graphql/graphql_oidc_keycloak/docker-compose.yml" OUT="${GRAPHQL_OIDC_KEYCLOAK_ENV:-$ROOT/graphql-oidc-keycloak.env}" ISSUER_HOST="${KEYCLOAK_ISSUER:-http://localhost:8081}" REALM=graphql @@ -96,4 +96,4 @@ KEYCLOAK_E2E_ADMIN_CLIENT_SECRET=admin-secret-e2e EOF echo "==> Wrote $OUT" cat "$OUT" -echo "==> Done. source $OUT && cargo test --test graphql_oidc_keycloak --features graphql,sqlite,metrics" +echo "==> Done. source $OUT && cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_keycloak::" diff --git a/scripts/oidc-zitadel-up.sh b/scripts/oidc-zitadel-up.sh index fbe3abf1b..b5638e316 100755 --- a/scripts/oidc-zitadel-up.sh +++ b/scripts/oidc-zitadel-up.sh @@ -5,12 +5,12 @@ # 1) Ensure writable dirs/volumes for IdP-generated secrets # 2) docker compose up -d --wait (or health probe) # 3) Run provider bootstrap → export GATE + OIDC_* + mint credentials -# 4) cargo test --test graphql_oidc_ with GATE=1 +# 4) cargo test --test graphql graphql_oidc_:: with GATE=1 set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" -COMPOSE_FILE="$ROOT/tests/graphql_oidc_zitadel/docker-compose.yml" -MACHINEKEY_DIR="$ROOT/tests/graphql_oidc_zitadel/machinekey" +COMPOSE_FILE="$ROOT/tests/graphql/graphql_oidc_zitadel/docker-compose.yml" +MACHINEKEY_DIR="$ROOT/tests/graphql/graphql_oidc_zitadel/machinekey" ZITADEL_HOST="${ZITADEL_HOST:-http://localhost:8080}" cd "$ROOT" @@ -99,4 +99,4 @@ chmod +x "$ROOT/scripts/ci-bootstrap-graphql-oidc.sh" echo "==> Done. Source env and run tests:" echo " set -a && source $ROOT/graphql-oidc.env && set +a" -echo " cargo test --test graphql_oidc_zitadel --features graphql,sqlite,metrics" +echo " cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_zitadel::" diff --git a/src/bus/kafka.rs b/src/bus/kafka.rs index 5c06f64ab..da080fcc5 100644 --- a/src/bus/kafka.rs +++ b/src/bus/kafka.rs @@ -11,7 +11,7 @@ //! the record, so consumers must tolerate duplicates. //! //! Requires the `kafka` feature (builds `librdkafka` via cmake). Integration- -//! tested in `tests/kafka_transport` against a broker (see `compose.yaml`). +//! tested in `tests/transports/kafka_transport` against a broker (see `compose.yaml`). use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; diff --git a/src/bus/kafka_bus.rs b/src/bus/kafka_bus.rs index 9fbf861c0..91d66cec7 100644 --- a/src/bus/kafka_bus.rs +++ b/src/bus/kafka_bus.rs @@ -16,7 +16,7 @@ //! prefix stripped. `{ns}` (namespace) scopes topics and groups so runs/apps //! don't collide. //! -//! Requires the `kafka` feature. Integration-tested in `tests/kafka_transport`. +//! Requires the `kafka` feature. Integration-tested in `tests/transports/kafka_transport`. use std::future::{Future, IntoFuture}; use std::pin::Pin; diff --git a/src/bus/nats.rs b/src/bus/nats.rs index 82bdaa149..0ffcbe0ad 100644 --- a/src/bus/nats.rs +++ b/src/bus/nats.rs @@ -8,7 +8,7 @@ //! retain their logical source identity separately; their broker dedup ID also //! binds content so altered retries reach the durable conflict fence. //! -//! Requires the `nats` feature. Integration-tested in `tests/nats_transport` +//! Requires the `nats` feature. Integration-tested in `tests/transports/nats_transport` //! against a JetStream-enabled server (see `compose.yaml`). use std::time::Duration; diff --git a/src/bus/nats_bus.rs b/src/bus/nats_bus.rs index 633bc566d..7f8b7753b 100644 --- a/src/bus/nats_bus.rs +++ b/src/bus/nats_bus.rs @@ -20,7 +20,7 @@ //! the same subscription inventory. Adding a filter does not replay messages //! previously skipped by that consumer; historical catch-up is explicit. //! -//! Requires the `nats` feature. Integration-tested in `tests/nats_transport`. +//! Requires the `nats` feature. Integration-tested in `tests/transports/nats_transport`. use std::future::{Future, IntoFuture}; use std::pin::Pin; diff --git a/src/bus/postgres_bus.rs b/src/bus/postgres_bus.rs index 9dda80ce1..001377cf4 100644 --- a/src/bus/postgres_bus.rs +++ b/src/bus/postgres_bus.rs @@ -34,7 +34,7 @@ //! cleanly. sqlxmq remains a viable future backend for its mature NOTIFY/backoff; //! revisit if those are needed. See [[tasks/build-transport-bus-facade]]. //! -//! Requires the `postgres` feature. Integration-tested in `tests/postgres_transport`. +//! Requires the `postgres` feature. Integration-tested in `tests/transports/postgres_transport`. //! //! [`Bus`]: super::Bus //! [`BusConsumer`]: super::BusConsumer diff --git a/src/bus/rabbitmq.rs b/src/bus/rabbitmq.rs index 0a4da824b..9f86b8559 100644 --- a/src/bus/rabbitmq.rs +++ b/src/bus/rabbitmq.rs @@ -8,7 +8,7 @@ //! exchange when one is configured on the queue). //! //! Requires the `rabbitmq` feature. Integration-tested in -//! `tests/rabbitmq_transport` against a broker (see `compose.yaml`). +//! `tests/transports/rabbitmq_transport` against a broker (see `compose.yaml`). use std::time::Duration; diff --git a/src/bus/rabbitmq_bus.rs b/src/bus/rabbitmq_bus.rs index 04246c7df..b318a645f 100644 --- a/src/bus/rabbitmq_bus.rs +++ b/src/bus/rabbitmq_bus.rs @@ -20,7 +20,7 @@ //! queues. `{ns}` (namespace) scopes queue and exchange names so multiple apps can //! share a broker. //! -//! Requires the `rabbitmq` feature. Integration-tested in `tests/rabbitmq_transport`. +//! Requires the `rabbitmq` feature. Integration-tested in `tests/transports/rabbitmq_transport`. use std::collections::HashSet; use std::future::{Future, IntoFuture}; diff --git a/src/bus/sqlite_bus.rs b/src/bus/sqlite_bus.rs index 74410b6d0..1ddb5da75 100644 --- a/src/bus/sqlite_bus.rs +++ b/src/bus/sqlite_bus.rs @@ -21,7 +21,7 @@ //! This is a no-extra-process transport for local development, tests, demos, and //! small single-node deployments. It is not a high-throughput broker replacement. //! -//! Requires the `sqlite` feature. Integration-tested in `tests/sqlite_transport`. +//! Requires the `sqlite` feature. Integration-tested in `tests/transports/sqlite_transport`. //! //! [`Bus`]: super::Bus //! [`BusConsumer`]: super::BusConsumer diff --git a/src/saga/mod.rs b/src/saga/mod.rs index 3181b032f..0ac47c2c0 100644 --- a/src/saga/mod.rs +++ b/src/saga/mod.rs @@ -41,7 +41,7 @@ //! compensated *as well*. Compensations therefore must be idempotent and //! must tolerate arriving before (or instead of) their action — the //! participant records a tombstone keyed by saga id so a late action is -//! rejected. The worked example in `tests/saga_transfer` shows this. +//! rejected. The worked example in `tests/services/saga_transfer` shows this. //! - **Compensation retries**: a failed/timed-out compensation is //! re-dispatched (new attempt, new timer) up to //! [`SagaDefinition::MAX_COMPENSATION_ATTEMPTS`], then the saga is diff --git a/tests/celld/README.md b/tests/celld/README.md index ca200fe09..c4807c107 100644 --- a/tests/celld/README.md +++ b/tests/celld/README.md @@ -178,7 +178,7 @@ then delivered to the e2e-celld native host, accepted by NATS JetStream, and applied by the normal Todo projection. A deployed fleet can keep the producer and consumer deployments as separate scripts without changing the relay code. -Without `CELLD_URL`, `cargo test --test celld` checks the fixtures and skips the +Without `CELLD_URL`, `cargo test --test services celld::` checks the fixtures and skips the live HTTP round trips. The independent storage proof owns a temporary celld fleet and deliberately diff --git a/tests/common/src/graphql.rs b/tests/common/src/graphql.rs index 5c47aa717..5ee1d87f6 100644 --- a/tests/common/src/graphql.rs +++ b/tests/common/src/graphql.rs @@ -30,7 +30,9 @@ macro_rules! with_repository { /// One case list, instantiated per dialect as `sqlite::` and /// `postgres::`. A case is an `async fn(Db)`; `module::{..}` groups -/// name cases in `crate::module`, bare names are cases at the crate root. +/// name cases in `::module`, bare names are cases of the +/// invoking module itself (each test binary groups former targets as modules, +/// so this is not the crate root). #[macro_export] macro_rules! on_each_dialect { (@cases $($(#[$meta:meta])* $case:ident),* $(,)?) => { @@ -47,13 +49,13 @@ macro_rules! on_each_dialect { $(mod $module { #[allow(unused_imports)] use super::db; - use crate::$module as scenarios; + use super::super::$module as scenarios; $crate::on_each_dialect!(@cases $($cases)*); })* #[allow(unused_imports)] mod root { use super::db; - use crate as scenarios; + use super::super as scenarios; $crate::on_each_dialect!(@cases $($root)*); } }; diff --git a/tests/aggregate_command/main.rs b/tests/core/aggregate_command/mod.rs similarity index 100% rename from tests/aggregate_command/main.rs rename to tests/core/aggregate_command/mod.rs diff --git a/tests/aggregate_command/thin.rs b/tests/core/aggregate_command/thin.rs similarity index 100% rename from tests/aggregate_command/thin.rs rename to tests/core/aggregate_command/thin.rs diff --git a/tests/aggregate_less_commands/main.rs b/tests/core/aggregate_less_commands/mod.rs similarity index 100% rename from tests/aggregate_less_commands/main.rs rename to tests/core/aggregate_less_commands/mod.rs diff --git a/tests/application_composition.rs b/tests/core/application_composition.rs similarity index 100% rename from tests/application_composition.rs rename to tests/core/application_composition.rs diff --git a/tests/causal_public_invoke/main.rs b/tests/core/causal_public_invoke/mod.rs similarity index 99% rename from tests/causal_public_invoke/main.rs rename to tests/core/causal_public_invoke/mod.rs index 109c1d8fa..024a22a85 100644 --- a/tests/causal_public_invoke/main.rs +++ b/tests/core/causal_public_invoke/mod.rs @@ -3,8 +3,6 @@ //! Proves `Service::dispatch_causal_with_receipt` is callable from an //! integration crate against an in-memory repository (no sqlx, no celld). -#![cfg(feature = "graphql")] - use distributed::command::{ typed_command, CommandInputType, CommandOutputType, CommandTypeDef, CommandTypeField, Succeeded, }; diff --git a/tests/causal_wait_path/main.rs b/tests/core/causal_wait_path/mod.rs similarity index 99% rename from tests/causal_wait_path/main.rs rename to tests/core/causal_wait_path/mod.rs index df3e10ce6..38f542eb7 100644 --- a/tests/causal_wait_path/main.rs +++ b/tests/core/causal_wait_path/mod.rs @@ -1,5 +1,4 @@ //! HTTP/gRPC causal wait-path and Bus send-has-no-reply. -#![cfg(all(feature = "graphql", feature = "http"))] use distributed::graphql::IdentityConfig; use std::sync::Arc; diff --git a/tests/core_command_contract.rs b/tests/core/core_command_contract.rs similarity index 94% rename from tests/core_command_contract.rs rename to tests/core/core_command_contract.rs index 8a236f2e7..a74c66557 100644 --- a/tests/core_command_contract.rs +++ b/tests/core/core_command_contract.rs @@ -1,8 +1,5 @@ #![allow(dead_code)] -// Derives in this package's integration targets resolve through the crate root. -pub use distributed::{command, graphql}; - use distributed::application::{CommandDefinition, Module}; use distributed::command::{typed_command, CommandInputType, CommandOutputType, Succeeded}; use distributed::graphql::{build_surface, graphql_sdl_from_surface, SurfaceOptions}; @@ -56,7 +53,7 @@ fn neutral_declarations_match_the_frozen_artifact() { // d188010d and edited since: `effects` and `confirmations` left the spec // and its fingerprint changed when those protocols were deleted. let expected: serde_json::Value = - serde_json::from_str(include_str!("fixtures/core-command-contract-v1.json")).unwrap(); + serde_json::from_str(include_str!("../fixtures/core-command-contract-v1.json")).unwrap(); assert_eq!( artifact::(), expected diff --git a/tests/core/main.rs b/tests/core/main.rs new file mode 100644 index 000000000..3a986ba33 --- /dev/null +++ b/tests/core/main.rs @@ -0,0 +1,22 @@ +//! Aggregates, commands, typed commands, event sourcing, snapshots, upcasting and replay. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test core ::` runs what `--test ` ran. + +mod aggregate_command; +mod aggregate_less_commands; +mod application_composition; +#[cfg(feature = "graphql")] +mod causal_public_invoke; +#[cfg(all(feature = "graphql", feature = "http"))] +mod causal_wait_path; +mod core_command_contract; +mod replay_event_version; +mod replay_property; +mod snapshots; +mod sourced; +mod sourced_snapshot; +mod sourced_upcasting; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod typed_commands; +mod upcasting; diff --git a/tests/replay_event_version.rs b/tests/core/replay_event_version.rs similarity index 100% rename from tests/replay_event_version.rs rename to tests/core/replay_event_version.rs diff --git a/tests/replay_property/aggregate.rs b/tests/core/replay_property/aggregate.rs similarity index 100% rename from tests/replay_property/aggregate.rs rename to tests/core/replay_property/aggregate.rs diff --git a/tests/replay_property/main.rs b/tests/core/replay_property/mod.rs similarity index 100% rename from tests/replay_property/main.rs rename to tests/core/replay_property/mod.rs diff --git a/tests/snapshots/main.rs b/tests/core/snapshots/mod.rs similarity index 100% rename from tests/snapshots/main.rs rename to tests/core/snapshots/mod.rs diff --git a/tests/sourced/custom_body_helpers.rs b/tests/core/sourced/custom_body_helpers.rs similarity index 97% rename from tests/sourced/custom_body_helpers.rs rename to tests/core/sourced/custom_body_helpers.rs index e34bdc41a..f4d7d761e 100644 --- a/tests/sourced/custom_body_helpers.rs +++ b/tests/core/sourced/custom_body_helpers.rs @@ -50,7 +50,7 @@ mod repository { #[event( "repository.branch_created", version = 2, - domain = with(crate::custom_body_helpers::facts::BranchCreated, branch_created) + domain = with(crate::sourced::custom_body_helpers::facts::BranchCreated, branch_created) )] fn record_branch(&mut self, id: String, name: String) { self.entity.set_id(id); diff --git a/tests/sourced/domain_events.rs b/tests/core/sourced/domain_events.rs similarity index 100% rename from tests/sourced/domain_events.rs rename to tests/core/sourced/domain_events.rs diff --git a/tests/sourced/flat_preview.rs b/tests/core/sourced/flat_preview.rs similarity index 100% rename from tests/sourced/flat_preview.rs rename to tests/core/sourced/flat_preview.rs diff --git a/tests/sourced/main.rs b/tests/core/sourced/mod.rs similarity index 100% rename from tests/sourced/main.rs rename to tests/core/sourced/mod.rs diff --git a/tests/sourced_snapshot/aggregates.rs b/tests/core/sourced_snapshot/aggregates.rs similarity index 100% rename from tests/sourced_snapshot/aggregates.rs rename to tests/core/sourced_snapshot/aggregates.rs diff --git a/tests/sourced_snapshot/main.rs b/tests/core/sourced_snapshot/mod.rs similarity index 100% rename from tests/sourced_snapshot/main.rs rename to tests/core/sourced_snapshot/mod.rs diff --git a/tests/sourced_upcasting/aggregate.rs b/tests/core/sourced_upcasting/aggregate.rs similarity index 100% rename from tests/sourced_upcasting/aggregate.rs rename to tests/core/sourced_upcasting/aggregate.rs diff --git a/tests/sourced_upcasting/main.rs b/tests/core/sourced_upcasting/mod.rs similarity index 100% rename from tests/sourced_upcasting/main.rs rename to tests/core/sourced_upcasting/mod.rs diff --git a/tests/typed_commands/main.rs b/tests/core/typed_commands/mod.rs similarity index 99% rename from tests/typed_commands/main.rs rename to tests/core/typed_commands/mod.rs index 05eaab0c2..be9f56204 100644 --- a/tests/typed_commands/main.rs +++ b/tests/core/typed_commands/mod.rs @@ -1,4 +1,3 @@ -#![cfg(all(feature = "graphql", feature = "sqlite"))] #![allow(dead_code)] use distributed::graphql::IdentityConfig; diff --git a/tests/upcasting/aggregate.rs b/tests/core/upcasting/aggregate.rs similarity index 100% rename from tests/upcasting/aggregate.rs rename to tests/core/upcasting/aggregate.rs diff --git a/tests/upcasting/main.rs b/tests/core/upcasting/mod.rs similarity index 100% rename from tests/upcasting/main.rs rename to tests/core/upcasting/mod.rs diff --git a/tests/e2e-ui/Makefile b/tests/e2e-ui/Makefile index 79f418be1..500ad5493 100644 --- a/tests/e2e-ui/Makefile +++ b/tests/e2e-ui/Makefile @@ -220,14 +220,14 @@ test-celld-http: cd $(REPO_ROOT) && \ CELLD_URL="$(CELLD_URL)" \ DISTRIBUTED_INTERNAL_SECRET="$(DISTRIBUTED_INTERNAL_SECRET)" \ - cargo test --test celld -- --nocapture + cargo test --test services celld:: -- --nocapture test-celld-nats: @echo "optional profile smoke — default make test / make run unchanged" cd $(REPO_ROOT) && \ CELLD_URL="$(CELLD_URL)" NATS_URL="$(NATS_URL)" \ DISTRIBUTED_INTERNAL_SECRET="$(DISTRIBUTED_INTERNAL_SECRET)" \ - cargo test --test e2e_ui_celld_nats_profile --features graphql,http,sqlite -- --nocapture + cargo test --test services --features graphql,http,sqlite e2e_ui_celld_nats_profile:: -- --nocapture application-build: $(DISTRIBUTED) build . @@ -305,8 +305,8 @@ help: @echo " make up-celld-nats optional celld+NATS profile (not make run)" @echo " celld :18880, version in /.celld-version; CELLD_BIN=" @echo " rebuild/restart with make up-celld-nats after Worker source changes" - @echo " make test-celld live --test celld + e2e_ui_celld_nats_profile (CI)" - @echo " make test-celld-nats cargo test --test e2e_ui_celld_nats_profile" + @echo " make test-celld live services celld:: + e2e_ui_celld_nats_profile:: (CI)" + @echo " make test-celld-nats cargo test --test services e2e_ui_celld_nats_profile::" @echo " make down-celld-nats stop NATS profile only" @echo " make down-celld stop celld and preserve its local dev store" @echo " GRAPHIQL=0 disable GraphiQL when running the API" diff --git a/tests/e2e-ui/celld-nats-profile/README.md b/tests/e2e-ui/celld-nats-profile/README.md index 3ddfc8fcb..d25d7ee9f 100644 --- a/tests/e2e-ui/celld-nats-profile/README.md +++ b/tests/e2e-ui/celld-nats-profile/README.md @@ -17,7 +17,7 @@ Optional profile: ```sh cd tests/e2e-ui make up-celld-nats # celld local store + Queue relay + NATS -make test-celld # live --test celld + GraphQL wait-path smoke (CI) +make test-celld # live `services` celld:: + GraphQL wait-path smoke (CI) make test-celld-nats # GraphQL wait-path smoke + SQL list only make down-celld-nats # NATS only make down-celld # celld; local state is preserved @@ -85,7 +85,7 @@ docker compose -f tests/e2e-ui/celld-nats-profile/docker-compose.yml up -d export CELLD_URL=http://127.0.0.1:${CELLD_HTTP_PORT:-18880} export NATS_URL=nats://127.0.0.1:${NATS_PORT:-14222} -cargo test --test e2e_ui_celld_nats_profile --features graphql,http,sqlite +cargo test --test services --features graphql,http,sqlite e2e_ui_celld_nats_profile:: ``` Without `CELLD_URL` **and** `NATS_URL`, the test still checks that the diff --git a/tests/gateway-native/Cargo.toml b/tests/gateway-native/Cargo.toml index 599f0944b..c41e9423f 100644 --- a/tests/gateway-native/Cargo.toml +++ b/tests/gateway-native/Cargo.toml @@ -24,4 +24,4 @@ serde_json = "1" [[test]] name = "gateway_ui" -path = "../gateway_ui.rs" +path = "../gateway/gateway_ui.rs" diff --git a/tests/gateway-portable/Cargo.toml b/tests/gateway-portable/Cargo.toml index 802109e12..440610dda 100644 --- a/tests/gateway-portable/Cargo.toml +++ b/tests/gateway-portable/Cargo.toml @@ -18,21 +18,21 @@ serde_json = "1" [[test]] name = "gateway_routing" -path = "../gateway_routing.rs" +path = "../gateway/gateway_routing.rs" [[test]] name = "gateway_extensions" -path = "../gateway_extensions.rs" +path = "../gateway/gateway_extensions.rs" [[test]] name = "gateway_auth" -path = "../gateway_auth.rs" +path = "../gateway/gateway_auth.rs" [[test]] name = "gateway_graphql_operation" -path = "../gateway_graphql_operation.rs" +path = "../gateway/gateway_graphql_operation.rs" [[test]] name = "edge_query_delivery" -path = "../edge_query_delivery.rs" +path = "../gateway/edge_query_delivery.rs" diff --git a/tests/gateway-postgres/run.py b/tests/gateway-postgres/run.py index a088c35c2..9475ecc4f 100644 --- a/tests/gateway-postgres/run.py +++ b/tests/gateway-postgres/run.py @@ -65,7 +65,7 @@ class Server(socketserver.ThreadingTCPServer): ready(standby) print("Fixture PostgreSQL " + docker("exec", primary, "postgres", "--version"), flush=True) env = {**os.environ, "GATEWAY_TEST_PRIMARY_URL": url(primary), "GATEWAY_TEST_REPLICA_URL": url(standby), "GATEWAY_TEST_PRIMARY_CONTAINER": primary} - subprocess.run(["cargo", "test", "-p", "distributed", "--no-default-features", "--features", "gateway,graphql,postgres", "--test", "edge_query_delivery_postgres", "--", "--ignored", "--nocapture"], cwd=ROOT, env=env, check=True) + subprocess.run(["cargo", "test", "-p", "distributed", "--no-default-features", "--features", "gateway,graphql,postgres", "--test", "gateway", "edge_query_delivery_postgres::", "--", "--ignored", "--nocapture"], cwd=ROOT, env=env, check=True) ready(primary) # The standby proof deliberately stops and restarts the primary. subprocess.run(["cargo", "test", "-p", "distributed", "--no-default-features", "--features", "gateway,graphql,postgres", "--lib", "graphql::delivery::versions::tests::postgres_transactional_coverage_and_snapshot_race", "--", "--ignored", "--nocapture"], cwd=ROOT, env=env, check=True) finally: diff --git a/tests/gateway-worker/README.md b/tests/gateway-worker/README.md index 33279a1de..2b5267fcb 100644 --- a/tests/gateway-worker/README.md +++ b/tests/gateway-worker/README.md @@ -16,7 +16,7 @@ python3 tests/gateway-worker/check_dependencies.py cargo check --manifest-path tests/gateway-worker/Cargo.toml --locked --target wasm32-unknown-unknown node tests/gateway-worker/proxy-runtime.mjs node tests/gateway-worker/run.mjs -cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql_query_protocol worker_ -- --ignored --nocapture --test-threads=1 +cargo test --no-default-features --features gateway-graphql-native,sqlite --test graphql graphql_query_protocol::worker_ -- --ignored --nocapture --test-threads=1 ``` Run these runtime commands sequentially: worker-build writes one generated diff --git a/tests/edge_query_delivery.rs b/tests/gateway/edge_query_delivery.rs similarity index 100% rename from tests/edge_query_delivery.rs rename to tests/gateway/edge_query_delivery.rs diff --git a/tests/edge_query_delivery_postgres.rs b/tests/gateway/edge_query_delivery_postgres.rs similarity index 98% rename from tests/edge_query_delivery_postgres.rs rename to tests/gateway/edge_query_delivery_postgres.rs index 6cfb58ce7..6259d6cd7 100644 --- a/tests/edge_query_delivery_postgres.rs +++ b/tests/gateway/edge_query_delivery_postgres.rs @@ -1,4 +1,3 @@ -#![cfg(all(feature = "gateway", feature = "graphql", feature = "postgres"))] use async_graphql::Request; use distributed::graphql::IdentityConfig; use distributed::graphql::{read, GraphqlEngine, ModelPermissions, ReadRouting}; diff --git a/tests/gateway_auth.rs b/tests/gateway/gateway_auth.rs similarity index 100% rename from tests/gateway_auth.rs rename to tests/gateway/gateway_auth.rs diff --git a/tests/gateway_extensions.rs b/tests/gateway/gateway_extensions.rs similarity index 100% rename from tests/gateway_extensions.rs rename to tests/gateway/gateway_extensions.rs diff --git a/tests/gateway_graphql.rs b/tests/gateway/gateway_graphql.rs similarity index 99% rename from tests/gateway_graphql.rs rename to tests/gateway/gateway_graphql.rs index 1ec4045d7..97357bde9 100644 --- a/tests/gateway_graphql.rs +++ b/tests/gateway/gateway_graphql.rs @@ -1,4 +1,3 @@ -#![cfg(all(feature = "gateway-graphql-native", feature = "sqlite"))] use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema, Subscription}; use async_graphql_axum::{GraphQLProtocol, GraphQLRequest, GraphQLResponse, GraphQLWebSocket}; use axum::{ diff --git a/tests/gateway_graphql_operation.rs b/tests/gateway/gateway_graphql_operation.rs similarity index 100% rename from tests/gateway_graphql_operation.rs rename to tests/gateway/gateway_graphql_operation.rs diff --git a/tests/gateway_routing.rs b/tests/gateway/gateway_routing.rs similarity index 100% rename from tests/gateway_routing.rs rename to tests/gateway/gateway_routing.rs diff --git a/tests/gateway_support/mod.rs b/tests/gateway/gateway_support/mod.rs similarity index 100% rename from tests/gateway_support/mod.rs rename to tests/gateway/gateway_support/mod.rs diff --git a/tests/gateway_ui.rs b/tests/gateway/gateway_ui.rs similarity index 100% rename from tests/gateway_ui.rs rename to tests/gateway/gateway_ui.rs diff --git a/tests/gateway/main.rs b/tests/gateway/main.rs new file mode 100644 index 000000000..7d069b66e --- /dev/null +++ b/tests/gateway/main.rs @@ -0,0 +1,31 @@ +//! The gateway: routing, auth, extensions, UI, GraphQL operations and edge query delivery. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test gateway ::` runs what `--test ` ran. +//! +//! `edge_query_delivery`, `gateway_auth`, `gateway_extensions`, +//! `gateway_graphql_operation`, `gateway_routing` and `gateway_ui` are also the +//! crate roots of the `tests/gateway-portable` and `tests/gateway-native` +//! fixtures, so they keep their own `#![cfg]`. Those that declare +//! `mod gateway_support;` are loaded with `#[path]`, which makes that +//! declaration resolve to `tests/gateway/gateway_support/` in both builds. + +#[cfg(feature = "gateway")] +mod edge_query_delivery; +#[cfg(all(feature = "gateway", feature = "graphql", feature = "postgres"))] +mod edge_query_delivery_postgres; +#[cfg(feature = "gateway")] +#[path = "gateway_auth.rs"] +mod gateway_auth; +#[cfg(feature = "gateway")] +#[path = "gateway_extensions.rs"] +mod gateway_extensions; +#[cfg(all(feature = "gateway-graphql-native", feature = "sqlite"))] +mod gateway_graphql; +#[cfg(feature = "gateway")] +mod gateway_graphql_operation; +#[cfg(feature = "gateway")] +#[path = "gateway_routing.rs"] +mod gateway_routing; +#[cfg(feature = "gateway-native")] +mod gateway_ui; diff --git a/tests/graphql_causal_transport/main.rs b/tests/graphql/graphql_causal_transport/mod.rs similarity index 99% rename from tests/graphql_causal_transport/main.rs rename to tests/graphql/graphql_causal_transport/mod.rs index 1c816a0e7..91e3cabdc 100644 --- a/tests/graphql_causal_transport/main.rs +++ b/tests/graphql/graphql_causal_transport/mod.rs @@ -1,5 +1,3 @@ -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use std::sync::Arc; use std::time::{Duration, SystemTime, UNIX_EPOCH}; diff --git a/tests/graphql_commands/main.rs b/tests/graphql/graphql_commands/mod.rs similarity index 99% rename from tests/graphql_commands/main.rs rename to tests/graphql/graphql_commands/mod.rs index 9cc534d09..775877d6e 100644 --- a/tests/graphql_commands/main.rs +++ b/tests/graphql/graphql_commands/mod.rs @@ -1,7 +1,5 @@ //! GraphQL command type metadata remains exact for typed causal commands. -#![cfg(feature = "graphql")] - use distributed::command::{CommandTypeDef, CommandTypeField}; #[test] diff --git a/tests/graphql_compile/main.rs b/tests/graphql/graphql_compile/mod.rs similarity index 99% rename from tests/graphql_compile/main.rs rename to tests/graphql/graphql_compile/mod.rs index a5104bb1a..fd4d26143 100644 --- a/tests/graphql_compile/main.rs +++ b/tests/graphql/graphql_compile/mod.rs @@ -1,8 +1,6 @@ //! Production compile-path behavioral goldens (via GraphqlEngine::execute). //! Empty placeholder removed — suite drives shipped compile_root through execute. -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use async_graphql::Request; use distributed::graphql::IdentityConfig; use distributed::graphql::{read, FilterExpr, GraphqlEngine, LitValue, ModelPermissions, Truth}; diff --git a/tests/graphql_engine/main.rs b/tests/graphql/graphql_engine/mod.rs similarity index 99% rename from tests/graphql_engine/main.rs rename to tests/graphql/graphql_engine/mod.rs index e26439b8c..0441c29f7 100644 --- a/tests/graphql_engine/main.rs +++ b/tests/graphql/graphql_engine/mod.rs @@ -1,7 +1,5 @@ //! GraphqlEngine builder validation tests. -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use distributed::graphql::IdentityConfig; use distributed::{ graphql::GraphqlEngine, ColumnType, PrimaryKey, RelationshipDef, RelationshipKind, TableColumn, diff --git a/tests/graphql_harden/access_paths.rs b/tests/graphql/graphql_harden/access_paths.rs similarity index 100% rename from tests/graphql_harden/access_paths.rs rename to tests/graphql/graphql_harden/access_paths.rs diff --git a/tests/graphql_harden/authz.rs b/tests/graphql/graphql_harden/authz.rs similarity index 100% rename from tests/graphql_harden/authz.rs rename to tests/graphql/graphql_harden/authz.rs diff --git a/tests/graphql_harden/dialect.rs b/tests/graphql/graphql_harden/dialect.rs similarity index 100% rename from tests/graphql_harden/dialect.rs rename to tests/graphql/graphql_harden/dialect.rs diff --git a/tests/graphql_harden/dos.rs b/tests/graphql/graphql_harden/dos.rs similarity index 100% rename from tests/graphql_harden/dos.rs rename to tests/graphql/graphql_harden/dos.rs diff --git a/tests/graphql_harden/errors.rs b/tests/graphql/graphql_harden/errors.rs similarity index 100% rename from tests/graphql_harden/errors.rs rename to tests/graphql/graphql_harden/errors.rs diff --git a/tests/graphql_harden/inject.rs b/tests/graphql/graphql_harden/inject.rs similarity index 100% rename from tests/graphql_harden/inject.rs rename to tests/graphql/graphql_harden/inject.rs diff --git a/tests/graphql_harden/json_columns.rs b/tests/graphql/graphql_harden/json_columns.rs similarity index 100% rename from tests/graphql_harden/json_columns.rs rename to tests/graphql/graphql_harden/json_columns.rs diff --git a/tests/graphql_harden/main.rs b/tests/graphql/graphql_harden/mod.rs similarity index 98% rename from tests/graphql_harden/main.rs rename to tests/graphql/graphql_harden/mod.rs index efde427fe..3cd62d968 100644 --- a/tests/graphql_harden/main.rs +++ b/tests/graphql/graphql_harden/mod.rs @@ -21,8 +21,6 @@ //! | `text_patterns` | `_like` / `_ilike` / `_icontains` mean the same on both dialects | //! | `dialect` | Dialect-honest comparison ops (no PG JSON ops on SQLite) | -#![cfg(all(feature = "graphql", feature = "sqlite"))] - mod access_paths; mod authz; mod dialect; diff --git a/tests/graphql_harden/residual.rs b/tests/graphql/graphql_harden/residual.rs similarity index 100% rename from tests/graphql_harden/residual.rs rename to tests/graphql/graphql_harden/residual.rs diff --git a/tests/graphql_harden/softskip.rs b/tests/graphql/graphql_harden/softskip.rs similarity index 100% rename from tests/graphql_harden/softskip.rs rename to tests/graphql/graphql_harden/softskip.rs diff --git a/tests/graphql_harden/text_patterns.rs b/tests/graphql/graphql_harden/text_patterns.rs similarity index 100% rename from tests/graphql_harden/text_patterns.rs rename to tests/graphql/graphql_harden/text_patterns.rs diff --git a/tests/graphql_harden/transport.rs b/tests/graphql/graphql_harden/transport.rs similarity index 100% rename from tests/graphql_harden/transport.rs rename to tests/graphql/graphql_harden/transport.rs diff --git a/tests/graphql_http/main.rs b/tests/graphql/graphql_http/mod.rs similarity index 98% rename from tests/graphql_http/main.rs rename to tests/graphql/graphql_http/mod.rs index b4fb1c5ab..4a873f5d5 100644 --- a/tests/graphql_http/main.rs +++ b/tests/graphql/graphql_http/mod.rs @@ -1,7 +1,5 @@ //! HTTP GraphiQL on/off + session role integration tests. -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use distributed::graphql::IdentityConfig; use std::sync::Arc; diff --git a/tests/graphql_identity/main.rs b/tests/graphql/graphql_identity/mod.rs similarity index 99% rename from tests/graphql_identity/main.rs rename to tests/graphql/graphql_identity/mod.rs index d56d6edf7..b7adf8468 100644 --- a/tests/graphql_identity/main.rs +++ b/tests/graphql/graphql_identity/mod.rs @@ -2,8 +2,6 @@ //! //! No network / no Zitadel. Synthetic RSA JWKS + JWT via jsonwebtoken. -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, RwLock}; use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/tests/graphql_literal_text/main.rs b/tests/graphql/graphql_literal_text/mod.rs similarity index 98% rename from tests/graphql_literal_text/main.rs rename to tests/graphql/graphql_literal_text/mod.rs index 080077681..63891a57a 100644 --- a/tests/graphql_literal_text/main.rs +++ b/tests/graphql/graphql_literal_text/mod.rs @@ -1,5 +1,4 @@ //! Real-database coverage for literal search through the generated GraphQL API. -#![cfg(all(feature = "graphql", any(feature = "sqlite", feature = "postgres")))] use common::env as env_support; diff --git a/tests/graphql_oidc_authentik/docker-compose.yml b/tests/graphql/graphql_oidc_authentik/docker-compose.yml similarity index 100% rename from tests/graphql_oidc_authentik/docker-compose.yml rename to tests/graphql/graphql_oidc_authentik/docker-compose.yml diff --git a/tests/graphql_oidc_authentik/main.rs b/tests/graphql/graphql_oidc_authentik/mod.rs similarity index 98% rename from tests/graphql_oidc_authentik/main.rs rename to tests/graphql/graphql_oidc_authentik/mod.rs index 4a04c40a1..18039a22e 100644 --- a/tests/graphql_oidc_authentik/main.rs +++ b/tests/graphql/graphql_oidc_authentik/mod.rs @@ -1,8 +1,6 @@ //! Authentik live e2e — E1–E8. Gate: `AUTHENTIK_E2E=1`. //! Mint: client_credentials ([[specs/query-layer/oidc-authentik]]). -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use common::oidc; use distributed::graphql::OidcConfig; diff --git a/tests/graphql_oidc_keycloak/docker-compose.yml b/tests/graphql/graphql_oidc_keycloak/docker-compose.yml similarity index 86% rename from tests/graphql_oidc_keycloak/docker-compose.yml rename to tests/graphql/graphql_oidc_keycloak/docker-compose.yml index 861927d9b..b4028dc1d 100644 --- a/tests/graphql_oidc_keycloak/docker-compose.yml +++ b/tests/graphql/graphql_oidc_keycloak/docker-compose.yml @@ -1,7 +1,7 @@ # Keycloak for GraphQL OIDC e2e (local + CI). # ./scripts/oidc-keycloak-up.sh # set -a && source graphql-oidc-keycloak.env && set +a -# cargo test --test graphql_oidc_keycloak --features graphql,sqlite,metrics +# cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_keycloak:: services: keycloak: image: quay.io/keycloak/keycloak:26.0 diff --git a/tests/graphql_oidc_keycloak/main.rs b/tests/graphql/graphql_oidc_keycloak/mod.rs similarity index 98% rename from tests/graphql_oidc_keycloak/main.rs rename to tests/graphql/graphql_oidc_keycloak/mod.rs index fa9d50e87..ef2df4704 100644 --- a/tests/graphql_oidc_keycloak/main.rs +++ b/tests/graphql/graphql_oidc_keycloak/mod.rs @@ -1,8 +1,6 @@ //! Keycloak live e2e — E1–E8. Gate: `KEYCLOAK_E2E=1`. //! Mint: client_credentials ([[specs/query-layer/oidc-keycloak]]). -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use common::oidc; use distributed::graphql::OidcConfig; diff --git a/tests/graphql_oidc_keycloak/realm-export.json b/tests/graphql/graphql_oidc_keycloak/realm-export.json similarity index 100% rename from tests/graphql_oidc_keycloak/realm-export.json rename to tests/graphql/graphql_oidc_keycloak/realm-export.json diff --git a/tests/graphql_oidc_zitadel/docker-compose.yml b/tests/graphql/graphql_oidc_zitadel/docker-compose.yml similarity index 83% rename from tests/graphql_oidc_zitadel/docker-compose.yml rename to tests/graphql/graphql_oidc_zitadel/docker-compose.yml index 190cc173a..047088f9c 100644 --- a/tests/graphql_oidc_zitadel/docker-compose.yml +++ b/tests/graphql/graphql_oidc_zitadel/docker-compose.yml @@ -4,11 +4,11 @@ # Prefer the helper (handles machinekey perms + wait + bootstrap): # ./scripts/oidc-zitadel-up.sh # set -a && source graphql-oidc.env && set +a -# cargo test --test graphql_oidc_zitadel --features graphql,sqlite,metrics +# cargo test --test graphql --features graphql,sqlite,metrics graphql_oidc_zitadel:: # # Or manually: -# mkdir -p tests/graphql_oidc_zitadel/machinekey && chmod 777 tests/graphql_oidc_zitadel/machinekey -# docker compose -f tests/graphql_oidc_zitadel/docker-compose.yml up -d --wait +# mkdir -p tests/graphql/graphql_oidc_zitadel/machinekey && chmod 777 tests/graphql/graphql_oidc_zitadel/machinekey +# docker compose -f tests/graphql/graphql_oidc_zitadel/docker-compose.yml up -d --wait # ./scripts/ci-bootstrap-graphql-oidc.sh services: zitadel-db: diff --git a/tests/graphql_oidc_zitadel/init/steps.yaml b/tests/graphql/graphql_oidc_zitadel/init/steps.yaml similarity index 100% rename from tests/graphql_oidc_zitadel/init/steps.yaml rename to tests/graphql/graphql_oidc_zitadel/init/steps.yaml diff --git a/tests/graphql_oidc_zitadel/init/zitadel.yaml b/tests/graphql/graphql_oidc_zitadel/init/zitadel.yaml similarity index 100% rename from tests/graphql_oidc_zitadel/init/zitadel.yaml rename to tests/graphql/graphql_oidc_zitadel/init/zitadel.yaml diff --git a/tests/graphql_oidc_zitadel/machinekey/.gitignore b/tests/graphql/graphql_oidc_zitadel/machinekey/.gitignore similarity index 100% rename from tests/graphql_oidc_zitadel/machinekey/.gitignore rename to tests/graphql/graphql_oidc_zitadel/machinekey/.gitignore diff --git a/tests/graphql_oidc_zitadel/main.rs b/tests/graphql/graphql_oidc_zitadel/mod.rs similarity index 98% rename from tests/graphql_oidc_zitadel/main.rs rename to tests/graphql/graphql_oidc_zitadel/mod.rs index 984670212..ed77f2539 100644 --- a/tests/graphql_oidc_zitadel/main.rs +++ b/tests/graphql/graphql_oidc_zitadel/mod.rs @@ -1,8 +1,6 @@ //! Zitadel live e2e — reference provider for [[specs/query-layer/oidc-e2e]] E1–E8. //! Gate: `ZITADEL_E2E=1`. Mint: JWT-bearer (adapter [[specs/query-layer/oidc-zitadel]]). -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use common::oidc; use std::path::PathBuf; diff --git a/tests/graphql_query_protocol/load.rs b/tests/graphql/graphql_query_protocol/load.rs similarity index 100% rename from tests/graphql_query_protocol/load.rs rename to tests/graphql/graphql_query_protocol/load.rs diff --git a/tests/graphql_query_protocol/main.rs b/tests/graphql/graphql_query_protocol/mod.rs similarity index 99% rename from tests/graphql_query_protocol/main.rs rename to tests/graphql/graphql_query_protocol/mod.rs index 9a109d7a1..288749e9b 100644 --- a/tests/graphql_query_protocol/main.rs +++ b/tests/graphql/graphql_query_protocol/mod.rs @@ -1,5 +1,3 @@ -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use distributed::graphql::IdentityConfig; use std::sync::Arc; use std::time::Duration; diff --git a/tests/graphql_sdl/main.rs b/tests/graphql/graphql_sdl/mod.rs similarity index 100% rename from tests/graphql_sdl/main.rs rename to tests/graphql/graphql_sdl/mod.rs diff --git a/tests/graphql_sqlite/main.rs b/tests/graphql/graphql_sqlite/mod.rs similarity index 99% rename from tests/graphql_sqlite/main.rs rename to tests/graphql/graphql_sqlite/mod.rs index 1611ce44d..5c6be6deb 100644 --- a/tests/graphql_sqlite/main.rs +++ b/tests/graphql/graphql_sqlite/mod.rs @@ -1,7 +1,5 @@ //! End-to-end GraphQL over temp-file SQLite (phase-2 exit criterion). -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use async_graphql::Request; use distributed::graphql::IdentityConfig; use distributed::{ diff --git a/tests/graphql_subscriptions_sqlite/main.rs b/tests/graphql/graphql_subscriptions_sqlite/mod.rs similarity index 99% rename from tests/graphql_subscriptions_sqlite/main.rs rename to tests/graphql/graphql_subscriptions_sqlite/mod.rs index f8b0f1606..928ae2453 100644 --- a/tests/graphql_subscriptions_sqlite/main.rs +++ b/tests/graphql/graphql_subscriptions_sqlite/mod.rs @@ -1,7 +1,5 @@ //! Phase-4 exit: GraphQL subscription pushes exactly once per projection commit (SQLite). -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use distributed::graphql::IdentityConfig; use std::time::Duration; diff --git a/tests/graphql_unique_key_live/main.rs b/tests/graphql/graphql_unique_key_live/mod.rs similarity index 99% rename from tests/graphql_unique_key_live/main.rs rename to tests/graphql/graphql_unique_key_live/mod.rs index d55c5e4b0..51acdc649 100644 --- a/tests/graphql_unique_key_live/main.rs +++ b/tests/graphql/graphql_unique_key_live/mod.rs @@ -1,5 +1,3 @@ -#![cfg(all(feature = "graphql", feature = "sqlite"))] - use distributed::bus::{Bus, InMemoryBus, Message, MessageKind, RunOptions}; use distributed::graphql::IdentityConfig; use distributed::graphql::{read, GraphqlEngine, ModelPermissions, SurfaceProjector}; diff --git a/tests/graphql/main.rs b/tests/graphql/main.rs new file mode 100644 index 000000000..1ccc67cc7 --- /dev/null +++ b/tests/graphql/main.rs @@ -0,0 +1,37 @@ +//! The GraphQL engine, its HTTP and subscription transports, identity and OIDC providers. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test graphql ::` runs what `--test ` ran. + +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_causal_transport; +#[cfg(feature = "graphql")] +mod graphql_commands; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_compile; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_engine; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_harden; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_http; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_identity; +#[cfg(all(feature = "graphql", any(feature = "sqlite", feature = "postgres")))] +mod graphql_literal_text; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_oidc_authentik; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_oidc_keycloak; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_oidc_zitadel; +// `load` and most helpers drive the native gateway. +#[cfg(all(feature = "gateway-graphql-native", feature = "sqlite"))] +mod graphql_query_protocol; +mod graphql_sdl; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_sqlite; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_subscriptions_sqlite; +#[cfg(all(feature = "graphql", feature = "sqlite"))] +mod graphql_unique_key_live; diff --git a/tests/observability/main.rs b/tests/observability/main.rs new file mode 100644 index 000000000..39290c652 --- /dev/null +++ b/tests/observability/main.rs @@ -0,0 +1,12 @@ +//! Prometheus exposition and OpenTelemetry export. +//! +//! A binary of its own: the metrics registry is process-global and +//! `metrics_exposition` asserts exact counter values. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test observability ::` runs what `--test ` ran. + +#[cfg(all(feature = "http", feature = "metrics"))] +mod metrics_exposition; +#[cfg(all(feature = "http", feature = "otel"))] +mod otel_export; diff --git a/tests/metrics_exposition/main.rs b/tests/observability/metrics_exposition/mod.rs similarity index 99% rename from tests/metrics_exposition/main.rs rename to tests/observability/metrics_exposition/mod.rs index cf5dad1e9..bc03223d4 100644 --- a/tests/metrics_exposition/main.rs +++ b/tests/observability/metrics_exposition/mod.rs @@ -11,7 +11,6 @@ //! //! The metrics registry is process-global, so everything runs in one test to //! keep the scraped snapshot deterministic. -#![cfg(all(feature = "http", feature = "metrics"))] use std::io::Write; use std::process::{Command, Stdio}; diff --git a/tests/otel_export/collector-config.yaml b/tests/observability/otel_export/collector-config.yaml similarity index 86% rename from tests/otel_export/collector-config.yaml rename to tests/observability/otel_export/collector-config.yaml index 7aea2e9b9..bd8166de7 100644 --- a/tests/otel_export/collector-config.yaml +++ b/tests/observability/otel_export/collector-config.yaml @@ -1,4 +1,4 @@ -# OpenTelemetry Collector config for the tests/otel_export e2e suite. +# OpenTelemetry Collector config for the tests/observability/otel_export e2e suite. # # Receives OTLP (http 4318 / grpc 4317) and writes every span batch as JSON # lines to /out/traces.json, which the test polls (mounted on the host via diff --git a/tests/otel_export/main.rs b/tests/observability/otel_export/mod.rs similarity index 99% rename from tests/otel_export/main.rs rename to tests/observability/otel_export/mod.rs index 4acf67184..e0b252cb7 100644 --- a/tests/otel_export/main.rs +++ b/tests/observability/otel_export/mod.rs @@ -16,7 +16,6 @@ //! - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` — e.g. `http://localhost:4318/v1/traces` //! - `OTEL_COLLECTOR_TRACES_FILE` — host path of the collector's file-exporter //! output (`/out/traces.json` in the container) -#![cfg(all(feature = "http", feature = "otel"))] use std::sync::Arc; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; diff --git a/tests/distributed_read_model/checkout.rs b/tests/read_models/distributed_read_model/checkout.rs similarity index 100% rename from tests/distributed_read_model/checkout.rs rename to tests/read_models/distributed_read_model/checkout.rs diff --git a/tests/distributed_read_model/checkout_saga_service/handlers/mod.rs b/tests/read_models/distributed_read_model/checkout_saga_service/handlers/mod.rs similarity index 100% rename from tests/distributed_read_model/checkout_saga_service/handlers/mod.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/handlers/mod.rs diff --git a/tests/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs b/tests/read_models/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs similarity index 91% rename from tests/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs index 32a6f99df..f9a5c0ef2 100644 --- a/tests/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs +++ b/tests/read_models/distributed_read_model/checkout_saga_service/handlers/record_seat_reserved.rs @@ -1,11 +1,11 @@ use distributed::microsvc::{Context, HandlerError}; use serde_json::{json, Value}; -use crate::checkout::{ +use crate::distributed_read_model::checkout::{ checkout_event, json_outbox_event, seat_event, SeatReservationCompleted, SeatReserved, CHECKOUT_SEAT_RESERVED, }; -use crate::checkout_saga_service::CheckoutRepo; +use crate::distributed_read_model::checkout_saga_service::CheckoutRepo; pub const EVENT: &str = seat_event::RESERVED; diff --git a/tests/distributed_read_model/checkout_saga_service/handlers/start.rs b/tests/read_models/distributed_read_model/checkout_saga_service/handlers/start.rs similarity index 91% rename from tests/distributed_read_model/checkout_saga_service/handlers/start.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/handlers/start.rs index 9e584b3f8..c3181ec84 100644 --- a/tests/distributed_read_model/checkout_saga_service/handlers/start.rs +++ b/tests/read_models/distributed_read_model/checkout_saga_service/handlers/start.rs @@ -2,10 +2,10 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::checkout::{ +use crate::distributed_read_model::checkout::{ checkout_command, checkout_event, json_outbox_event, CheckoutStarted, StartCheckout, }; -use crate::checkout_saga_service::CheckoutSaga; +use crate::distributed_read_model::checkout_saga_service::CheckoutSaga; pub const COMMAND: &str = checkout_command::START; diff --git a/tests/distributed_read_model/checkout_saga_service/mod.rs b/tests/read_models/distributed_read_model/checkout_saga_service/mod.rs similarity index 100% rename from tests/distributed_read_model/checkout_saga_service/mod.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/mod.rs diff --git a/tests/distributed_read_model/checkout_saga_service/models/mod.rs b/tests/read_models/distributed_read_model/checkout_saga_service/models/mod.rs similarity index 100% rename from tests/distributed_read_model/checkout_saga_service/models/mod.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/models/mod.rs diff --git a/tests/distributed_read_model/checkout_saga_service/models/saga.rs b/tests/read_models/distributed_read_model/checkout_saga_service/models/saga.rs similarity index 93% rename from tests/distributed_read_model/checkout_saga_service/models/saga.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/models/saga.rs index a6bdea6ab..74c5c51bc 100644 --- a/tests/distributed_read_model/checkout_saga_service/models/saga.rs +++ b/tests/read_models/distributed_read_model/checkout_saga_service/models/saga.rs @@ -1,6 +1,6 @@ use distributed::{sourced, Entity, Snapshot}; -use crate::checkout::{CHECKOUT_SEAT_RESERVED, CHECKOUT_STARTED}; +use crate::distributed_read_model::checkout::{CHECKOUT_SEAT_RESERVED, CHECKOUT_STARTED}; /// Checkout saga aggregate, keyed by checkout id. It records checkout-process /// facts and emits saga events; it does not call the seat aggregate directly. diff --git a/tests/distributed_read_model/checkout_saga_service/service.rs b/tests/read_models/distributed_read_model/checkout_saga_service/service.rs similarity index 100% rename from tests/distributed_read_model/checkout_saga_service/service.rs rename to tests/read_models/distributed_read_model/checkout_saga_service/service.rs diff --git a/tests/distributed_read_model/main.rs b/tests/read_models/distributed_read_model/mod.rs similarity index 100% rename from tests/distributed_read_model/main.rs rename to tests/read_models/distributed_read_model/mod.rs diff --git a/tests/distributed_read_model/projection_service/handlers/checkout.rs b/tests/read_models/distributed_read_model/projection_service/handlers/checkout.rs similarity index 93% rename from tests/distributed_read_model/projection_service/handlers/checkout.rs rename to tests/read_models/distributed_read_model/projection_service/handlers/checkout.rs index cf0bc19c5..6f6b2a600 100644 --- a/tests/distributed_read_model/projection_service/handlers/checkout.rs +++ b/tests/read_models/distributed_read_model/projection_service/handlers/checkout.rs @@ -2,12 +2,12 @@ use distributed::microsvc::{Context, HandlerError}; use distributed::ReadModelWorkspaceExt; use serde_json::{json, Value}; -use crate::checkout::{ +use crate::distributed_read_model::checkout::{ checkout_event, CheckoutStarted, SeatReservationCompleted, CHECKOUT_SEAT_RESERVED, CHECKOUT_STARTED, RESERVING_SEAT_MESSAGE, SEAT_RESERVED_MESSAGE, }; -use crate::projection_service::ProjectionDependencies; -use crate::read_models::{CheckoutStepView, CheckoutView}; +use crate::distributed_read_model::projection_service::ProjectionDependencies; +use crate::distributed_read_model::read_models::{CheckoutStepView, CheckoutView}; pub const EVENTS: &[&str] = &[ checkout_event::STARTED, diff --git a/tests/distributed_read_model/projection_service/handlers/mod.rs b/tests/read_models/distributed_read_model/projection_service/handlers/mod.rs similarity index 100% rename from tests/distributed_read_model/projection_service/handlers/mod.rs rename to tests/read_models/distributed_read_model/projection_service/handlers/mod.rs diff --git a/tests/distributed_read_model/projection_service/handlers/seat.rs b/tests/read_models/distributed_read_model/projection_service/handlers/seat.rs similarity index 88% rename from tests/distributed_read_model/projection_service/handlers/seat.rs rename to tests/read_models/distributed_read_model/projection_service/handlers/seat.rs index 80c5a9ebb..f28cc6992 100644 --- a/tests/distributed_read_model/projection_service/handlers/seat.rs +++ b/tests/read_models/distributed_read_model/projection_service/handlers/seat.rs @@ -2,9 +2,11 @@ use distributed::microsvc::{Context, HandlerError}; use distributed::ReadModelWorkspaceExt; use serde_json::{json, Value}; -use crate::checkout::{seat_event, SeatAdded, SeatReserved, SEAT_AVAILABLE, SEAT_RESERVED}; -use crate::projection_service::ProjectionDependencies; -use crate::read_models::{CheckoutStepView, SeatView}; +use crate::distributed_read_model::checkout::{ + seat_event, SeatAdded, SeatReserved, SEAT_AVAILABLE, SEAT_RESERVED, +}; +use crate::distributed_read_model::projection_service::ProjectionDependencies; +use crate::distributed_read_model::read_models::{CheckoutStepView, SeatView}; pub const EVENTS: &[&str] = &[seat_event::ADDED, seat_event::RESERVED]; diff --git a/tests/distributed_read_model/projection_service/mod.rs b/tests/read_models/distributed_read_model/projection_service/mod.rs similarity index 100% rename from tests/distributed_read_model/projection_service/mod.rs rename to tests/read_models/distributed_read_model/projection_service/mod.rs diff --git a/tests/distributed_read_model/projection_service/service.rs b/tests/read_models/distributed_read_model/projection_service/service.rs similarity index 100% rename from tests/distributed_read_model/projection_service/service.rs rename to tests/read_models/distributed_read_model/projection_service/service.rs diff --git a/tests/distributed_read_model/query_service/mod.rs b/tests/read_models/distributed_read_model/query_service/mod.rs similarity index 92% rename from tests/distributed_read_model/query_service/mod.rs rename to tests/read_models/distributed_read_model/query_service/mod.rs index a9a678fac..56a9cf52f 100644 --- a/tests/distributed_read_model/query_service/mod.rs +++ b/tests/read_models/distributed_read_model/query_service/mod.rs @@ -4,7 +4,7 @@ use distributed::{InMemoryReadModelStore, ReadModelWorkspaceExt, TableStoreError}; -use crate::read_models::{checkout_key, seat_key, CheckoutView, SeatView}; +use crate::distributed_read_model::read_models::{checkout_key, seat_key, CheckoutView, SeatView}; #[derive(Clone)] pub struct CheckoutQueryService { diff --git a/tests/distributed_read_model/read_models/checkout_step_view.rs b/tests/read_models/distributed_read_model/read_models/checkout_step_view.rs similarity index 100% rename from tests/distributed_read_model/read_models/checkout_step_view.rs rename to tests/read_models/distributed_read_model/read_models/checkout_step_view.rs diff --git a/tests/distributed_read_model/read_models/checkout_view.rs b/tests/read_models/distributed_read_model/read_models/checkout_view.rs similarity index 100% rename from tests/distributed_read_model/read_models/checkout_view.rs rename to tests/read_models/distributed_read_model/read_models/checkout_view.rs diff --git a/tests/distributed_read_model/read_models/mod.rs b/tests/read_models/distributed_read_model/read_models/mod.rs similarity index 100% rename from tests/distributed_read_model/read_models/mod.rs rename to tests/read_models/distributed_read_model/read_models/mod.rs diff --git a/tests/distributed_read_model/read_models/seat_view.rs b/tests/read_models/distributed_read_model/read_models/seat_view.rs similarity index 100% rename from tests/distributed_read_model/read_models/seat_view.rs rename to tests/read_models/distributed_read_model/read_models/seat_view.rs diff --git a/tests/distributed_read_model/seat_inventory_service/handlers/add.rs b/tests/read_models/distributed_read_model/seat_inventory_service/handlers/add.rs similarity index 84% rename from tests/distributed_read_model/seat_inventory_service/handlers/add.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/handlers/add.rs index 8e4c4e81c..3914f1901 100644 --- a/tests/distributed_read_model/seat_inventory_service/handlers/add.rs +++ b/tests/read_models/distributed_read_model/seat_inventory_service/handlers/add.rs @@ -2,8 +2,10 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::checkout::{json_outbox_event, seat_command, seat_event, AddSeat, SeatAdded}; -use crate::seat_inventory_service::Seat; +use crate::distributed_read_model::checkout::{ + json_outbox_event, seat_command, seat_event, AddSeat, SeatAdded, +}; +use crate::distributed_read_model::seat_inventory_service::Seat; pub const COMMAND: &str = seat_command::ADD; diff --git a/tests/distributed_read_model/seat_inventory_service/handlers/mod.rs b/tests/read_models/distributed_read_model/seat_inventory_service/handlers/mod.rs similarity index 100% rename from tests/distributed_read_model/seat_inventory_service/handlers/mod.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/handlers/mod.rs diff --git a/tests/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs b/tests/read_models/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs similarity index 93% rename from tests/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs index 3987879c4..55c388605 100644 --- a/tests/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs +++ b/tests/read_models/distributed_read_model/seat_inventory_service/handlers/reserve_started_checkout_seat.rs @@ -1,11 +1,11 @@ use distributed::microsvc::{Context, HandlerError}; use serde_json::{json, Value}; -use crate::checkout::{ +use crate::distributed_read_model::checkout::{ checkout_event, json_outbox_event, seat_event, CheckoutStarted, SeatReserved, SEAT_AVAILABLE, SEAT_RESERVED, }; -use crate::seat_inventory_service::SeatRepo; +use crate::distributed_read_model::seat_inventory_service::SeatRepo; pub const EVENT: &str = checkout_event::STARTED; diff --git a/tests/distributed_read_model/seat_inventory_service/mod.rs b/tests/read_models/distributed_read_model/seat_inventory_service/mod.rs similarity index 100% rename from tests/distributed_read_model/seat_inventory_service/mod.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/mod.rs diff --git a/tests/distributed_read_model/seat_inventory_service/models/mod.rs b/tests/read_models/distributed_read_model/seat_inventory_service/models/mod.rs similarity index 100% rename from tests/distributed_read_model/seat_inventory_service/models/mod.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/models/mod.rs diff --git a/tests/distributed_read_model/seat_inventory_service/models/seat.rs b/tests/read_models/distributed_read_model/seat_inventory_service/models/seat.rs similarity index 92% rename from tests/distributed_read_model/seat_inventory_service/models/seat.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/models/seat.rs index 9a22d3f43..2dd129ee3 100644 --- a/tests/distributed_read_model/seat_inventory_service/models/seat.rs +++ b/tests/read_models/distributed_read_model/seat_inventory_service/models/seat.rs @@ -1,6 +1,6 @@ use distributed::{sourced, Entity, Snapshot}; -use crate::checkout::{SEAT_AVAILABLE, SEAT_RESERVED}; +use crate::distributed_read_model::checkout::{SEAT_AVAILABLE, SEAT_RESERVED}; /// Seat inventory aggregate, keyed by seat id. It owns seat availability and /// reservation invariants. diff --git a/tests/distributed_read_model/seat_inventory_service/service.rs b/tests/read_models/distributed_read_model/seat_inventory_service/service.rs similarity index 100% rename from tests/distributed_read_model/seat_inventory_service/service.rs rename to tests/read_models/distributed_read_model/seat_inventory_service/service.rs diff --git a/tests/distributed_read_model_board/board_service/handlers/board_add_card.rs b/tests/read_models/distributed_read_model_board/board_service/handlers/board_add_card.rs similarity index 87% rename from tests/distributed_read_model_board/board_service/handlers/board_add_card.rs rename to tests/read_models/distributed_read_model_board/board_service/handlers/board_add_card.rs index 6a5284243..b370c5a2c 100644 --- a/tests/distributed_read_model_board/board_service/handlers/board_add_card.rs +++ b/tests/read_models/distributed_read_model_board/board_service/handlers/board_add_card.rs @@ -2,8 +2,8 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::board_service::handlers::board_state_message; -use crate::board_service::{AddCard, Board}; +use crate::distributed_read_model_board::board_service::handlers::board_state_message; +use crate::distributed_read_model_board::board_service::{AddCard, Board}; pub const COMMAND: &str = "board.add_card"; diff --git a/tests/distributed_read_model_board/board_service/handlers/board_move_card.rs b/tests/read_models/distributed_read_model_board/board_service/handlers/board_move_card.rs similarity index 86% rename from tests/distributed_read_model_board/board_service/handlers/board_move_card.rs rename to tests/read_models/distributed_read_model_board/board_service/handlers/board_move_card.rs index a5c7e784f..4408652d4 100644 --- a/tests/distributed_read_model_board/board_service/handlers/board_move_card.rs +++ b/tests/read_models/distributed_read_model_board/board_service/handlers/board_move_card.rs @@ -2,8 +2,8 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::board_service::handlers::board_state_message; -use crate::board_service::{Board, MoveCard}; +use crate::distributed_read_model_board::board_service::handlers::board_state_message; +use crate::distributed_read_model_board::board_service::{Board, MoveCard}; pub const COMMAND: &str = "board.move_card"; diff --git a/tests/distributed_read_model_board/board_service/handlers/board_open.rs b/tests/read_models/distributed_read_model_board/board_service/handlers/board_open.rs similarity index 86% rename from tests/distributed_read_model_board/board_service/handlers/board_open.rs rename to tests/read_models/distributed_read_model_board/board_service/handlers/board_open.rs index 18e5ed2f1..c4ad4f82a 100644 --- a/tests/distributed_read_model_board/board_service/handlers/board_open.rs +++ b/tests/read_models/distributed_read_model_board/board_service/handlers/board_open.rs @@ -2,8 +2,8 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::board_service::handlers::board_state_message; -use crate::board_service::{Board, OpenBoard}; +use crate::distributed_read_model_board::board_service::handlers::board_state_message; +use crate::distributed_read_model_board::board_service::{Board, OpenBoard}; pub const COMMAND: &str = "board.open"; diff --git a/tests/distributed_read_model_board/board_service/handlers/board_remove_card.rs b/tests/read_models/distributed_read_model_board/board_service/handlers/board_remove_card.rs similarity index 86% rename from tests/distributed_read_model_board/board_service/handlers/board_remove_card.rs rename to tests/read_models/distributed_read_model_board/board_service/handlers/board_remove_card.rs index 10726c64d..658edfeb2 100644 --- a/tests/distributed_read_model_board/board_service/handlers/board_remove_card.rs +++ b/tests/read_models/distributed_read_model_board/board_service/handlers/board_remove_card.rs @@ -2,8 +2,8 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::Serialize; -use crate::board_service::handlers::board_state_message; -use crate::board_service::{Board, RemoveCard}; +use crate::distributed_read_model_board::board_service::handlers::board_state_message; +use crate::distributed_read_model_board::board_service::{Board, RemoveCard}; pub const COMMAND: &str = "board.remove_card"; diff --git a/tests/distributed_read_model_board/board_service/handlers/mod.rs b/tests/read_models/distributed_read_model_board/board_service/handlers/mod.rs similarity index 91% rename from tests/distributed_read_model_board/board_service/handlers/mod.rs rename to tests/read_models/distributed_read_model_board/board_service/handlers/mod.rs index c708150b0..5130e68f9 100644 --- a/tests/distributed_read_model_board/board_service/handlers/mod.rs +++ b/tests/read_models/distributed_read_model_board/board_service/handlers/mod.rs @@ -5,7 +5,7 @@ pub(super) mod board_remove_card; use distributed::{OutboxMessage, SourcedResult}; -use crate::board_service::Board; +use crate::distributed_read_model_board::board_service::Board; /// Compatibility envelope for this legacy demo projector. /// diff --git a/tests/distributed_read_model_board/board_service/mod.rs b/tests/read_models/distributed_read_model_board/board_service/mod.rs similarity index 100% rename from tests/distributed_read_model_board/board_service/mod.rs rename to tests/read_models/distributed_read_model_board/board_service/mod.rs diff --git a/tests/distributed_read_model_board/board_service/models/board.rs b/tests/read_models/distributed_read_model_board/board_service/models/board.rs similarity index 100% rename from tests/distributed_read_model_board/board_service/models/board.rs rename to tests/read_models/distributed_read_model_board/board_service/models/board.rs diff --git a/tests/distributed_read_model_board/board_service/models/mod.rs b/tests/read_models/distributed_read_model_board/board_service/models/mod.rs similarity index 100% rename from tests/distributed_read_model_board/board_service/models/mod.rs rename to tests/read_models/distributed_read_model_board/board_service/models/mod.rs diff --git a/tests/distributed_read_model_board/board_service/service.rs b/tests/read_models/distributed_read_model_board/board_service/service.rs similarity index 100% rename from tests/distributed_read_model_board/board_service/service.rs rename to tests/read_models/distributed_read_model_board/board_service/service.rs diff --git a/tests/distributed_read_model_board/main.rs b/tests/read_models/distributed_read_model_board/mod.rs similarity index 100% rename from tests/distributed_read_model_board/main.rs rename to tests/read_models/distributed_read_model_board/mod.rs diff --git a/tests/distributed_read_model_board/projections_service/handlers/board.rs b/tests/read_models/distributed_read_model_board/projections_service/handlers/board.rs similarity index 92% rename from tests/distributed_read_model_board/projections_service/handlers/board.rs rename to tests/read_models/distributed_read_model_board/projections_service/handlers/board.rs index a25a1f766..b3a3a0cfc 100644 --- a/tests/distributed_read_model_board/projections_service/handlers/board.rs +++ b/tests/read_models/distributed_read_model_board/projections_service/handlers/board.rs @@ -7,9 +7,13 @@ use distributed::microsvc::{Context, HandlerError}; use distributed::{BitcodePayloadCodec, PayloadCodec, ReadModelWorkspaceExt}; use serde_json::{json, Value}; -use crate::board_service::BoardSnapshot; -use crate::projections_service::{read_model_error, ProjectionDependencies}; -use crate::read_models::{board_key, BoardView, CardPayload, CardView}; +use crate::distributed_read_model_board::board_service::BoardSnapshot; +use crate::distributed_read_model_board::projections_service::{ + read_model_error, ProjectionDependencies, +}; +use crate::distributed_read_model_board::read_models::{ + board_key, BoardView, CardPayload, CardView, +}; pub const EVENTS: &[&str] = &[ "board.opened", diff --git a/tests/distributed_read_model_board/projections_service/handlers/mod.rs b/tests/read_models/distributed_read_model_board/projections_service/handlers/mod.rs similarity index 100% rename from tests/distributed_read_model_board/projections_service/handlers/mod.rs rename to tests/read_models/distributed_read_model_board/projections_service/handlers/mod.rs diff --git a/tests/distributed_read_model_board/projections_service/mod.rs b/tests/read_models/distributed_read_model_board/projections_service/mod.rs similarity index 93% rename from tests/distributed_read_model_board/projections_service/mod.rs rename to tests/read_models/distributed_read_model_board/projections_service/mod.rs index 28b3f6f1b..6ee9d3d9c 100644 --- a/tests/distributed_read_model_board/projections_service/mod.rs +++ b/tests/read_models/distributed_read_model_board/projections_service/mod.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use distributed::microsvc::{HandlerError, Routes, Service}; use distributed::{InMemoryReadModelStore, ReadModelWorkspaceExt, TableStoreError}; -use crate::read_models::{board_key, BoardView}; +use crate::distributed_read_model_board::read_models::{board_key, BoardView}; pub type ProjectionDependencies = InMemoryReadModelStore; diff --git a/tests/distributed_read_model_board/query_service/mod.rs b/tests/read_models/distributed_read_model_board/query_service/mod.rs similarity index 92% rename from tests/distributed_read_model_board/query_service/mod.rs rename to tests/read_models/distributed_read_model_board/query_service/mod.rs index 52a822c4d..6c43f5a29 100644 --- a/tests/distributed_read_model_board/query_service/mod.rs +++ b/tests/read_models/distributed_read_model_board/query_service/mod.rs @@ -3,7 +3,7 @@ use distributed::{InMemoryReadModelStore, ReadModelWorkspaceExt, TableStoreError}; -use crate::read_models::{board_key, card_key, BoardView, CardView}; +use crate::distributed_read_model_board::read_models::{board_key, card_key, BoardView, CardView}; #[derive(Clone)] pub struct BoardQueryService { diff --git a/tests/distributed_read_model_board/read_models/board_view.rs b/tests/read_models/distributed_read_model_board/read_models/board_view.rs similarity index 100% rename from tests/distributed_read_model_board/read_models/board_view.rs rename to tests/read_models/distributed_read_model_board/read_models/board_view.rs diff --git a/tests/distributed_read_model_board/read_models/card_view.rs b/tests/read_models/distributed_read_model_board/read_models/card_view.rs similarity index 100% rename from tests/distributed_read_model_board/read_models/card_view.rs rename to tests/read_models/distributed_read_model_board/read_models/card_view.rs diff --git a/tests/distributed_read_model_board/read_models/mod.rs b/tests/read_models/distributed_read_model_board/read_models/mod.rs similarity index 100% rename from tests/distributed_read_model_board/read_models/mod.rs rename to tests/read_models/distributed_read_model_board/read_models/mod.rs diff --git a/tests/domain_event_projection_server.rs b/tests/read_models/domain_event_projection_server.rs similarity index 100% rename from tests/domain_event_projection_server.rs rename to tests/read_models/domain_event_projection_server.rs diff --git a/tests/read_models/main.rs b/tests/read_models/main.rs new file mode 100644 index 000000000..564187bf6 --- /dev/null +++ b/tests/read_models/main.rs @@ -0,0 +1,15 @@ +//! Read models, projections and the distributed read-model services. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test read_models ::` runs what `--test ` ran. + +mod distributed_read_model; +mod distributed_read_model_board; +mod domain_event_projection_server; +mod named_read_models; +mod read_model_commit_bridge; +mod read_model_keyset; +mod read_model_metadata; +mod read_model_relationship_includes; +mod read_model_schema_bootstrap; +mod read_model_session; diff --git a/tests/named_read_models.rs b/tests/read_models/named_read_models.rs similarity index 100% rename from tests/named_read_models.rs rename to tests/read_models/named_read_models.rs diff --git a/tests/read_model_commit_bridge/main.rs b/tests/read_models/read_model_commit_bridge/mod.rs similarity index 100% rename from tests/read_model_commit_bridge/main.rs rename to tests/read_models/read_model_commit_bridge/mod.rs diff --git a/tests/read_model_keyset/main.rs b/tests/read_models/read_model_keyset/mod.rs similarity index 100% rename from tests/read_model_keyset/main.rs rename to tests/read_models/read_model_keyset/mod.rs diff --git a/tests/read_model_metadata/main.rs b/tests/read_models/read_model_metadata/mod.rs similarity index 100% rename from tests/read_model_metadata/main.rs rename to tests/read_models/read_model_metadata/mod.rs diff --git a/tests/read_model_relationship_includes/main.rs b/tests/read_models/read_model_relationship_includes/mod.rs similarity index 100% rename from tests/read_model_relationship_includes/main.rs rename to tests/read_models/read_model_relationship_includes/mod.rs diff --git a/tests/read_model_schema_bootstrap/main.rs b/tests/read_models/read_model_schema_bootstrap/mod.rs similarity index 100% rename from tests/read_model_schema_bootstrap/main.rs rename to tests/read_models/read_model_schema_bootstrap/mod.rs diff --git a/tests/read_model_session/main.rs b/tests/read_models/read_model_session/mod.rs similarity index 100% rename from tests/read_model_session/main.rs rename to tests/read_models/read_model_session/mod.rs diff --git a/tests/aggregate_schedules.rs b/tests/repositories/aggregate_schedules.rs similarity index 98% rename from tests/aggregate_schedules.rs rename to tests/repositories/aggregate_schedules.rs index fd7f081bd..48ef0678f 100644 --- a/tests/aggregate_schedules.rs +++ b/tests/repositories/aggregate_schedules.rs @@ -2,9 +2,7 @@ //! transaction, owned by the batch's one stream, relative due times resolved //! by the database clock, re-arming bumps the generation, cancelling //! disarms. Dispatching them is the schedule worker's job -//! (`tests/schedule_worker`). - -#![cfg(feature = "sqlite")] +//! (`tests/repositories/schedule_worker`). use std::time::{Duration, SystemTime}; diff --git a/tests/coordination_lease/main.rs b/tests/repositories/coordination_lease/mod.rs similarity index 100% rename from tests/coordination_lease/main.rs rename to tests/repositories/coordination_lease/mod.rs diff --git a/tests/durable_enqueue_sqlite/main.rs b/tests/repositories/durable_enqueue_sqlite/mod.rs similarity index 99% rename from tests/durable_enqueue_sqlite/main.rs rename to tests/repositories/durable_enqueue_sqlite/mod.rs index 70be145a0..0d4137d29 100644 --- a/tests/durable_enqueue_sqlite/main.rs +++ b/tests/repositories/durable_enqueue_sqlite/mod.rs @@ -4,8 +4,6 @@ //! persistent repository, not just the in-memory `InMemoryRepository` covered by //! the unit tests. -#![cfg(feature = "sqlite")] - use serde::{Deserialize, Serialize}; use serde_json::json; diff --git a/tests/event_store/main.rs b/tests/repositories/event_store/mod.rs similarity index 100% rename from tests/event_store/main.rs rename to tests/repositories/event_store/mod.rs diff --git a/tests/in_memory_repository_conformance/main.rs b/tests/repositories/in_memory_repository_conformance/mod.rs similarity index 100% rename from tests/in_memory_repository_conformance/main.rs rename to tests/repositories/in_memory_repository_conformance/mod.rs diff --git a/tests/repositories/main.rs b/tests/repositories/main.rs new file mode 100644 index 000000000..854e6e084 --- /dev/null +++ b/tests/repositories/main.rs @@ -0,0 +1,29 @@ +//! Repositories and their conformance suites, the event store, the queued repository, leases, locks, schedules and the outbox. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test repositories ::` runs what `--test ` ran. + +#[cfg(feature = "sqlite")] +mod aggregate_schedules; +mod coordination_lease; +#[cfg(feature = "sqlite")] +mod durable_enqueue_sqlite; +mod event_store; +mod in_memory_repository_conformance; +#[cfg(feature = "postgres")] +mod postgres_repository; +#[cfg(feature = "postgres")] +mod postgres_repository_conformance; +mod queued_repo; +mod repository_api; +#[cfg(any(feature = "sqlite", feature = "postgres"))] +mod schedule_worker; +mod scheduled_outbox; +#[cfg(feature = "sqlite")] +mod snapshot_sqlite_hardening; +#[cfg(any(feature = "sqlite", feature = "postgres"))] +mod sql_lock_manager; +#[cfg(feature = "sqlite")] +mod sqlite_repository; +#[cfg(feature = "sqlite")] +mod sqlite_repository_conformance; diff --git a/tests/postgres_repository/main.rs b/tests/repositories/postgres_repository/mod.rs similarity index 99% rename from tests/postgres_repository/main.rs rename to tests/repositories/postgres_repository/mod.rs index b307b1bce..36d785046 100644 --- a/tests/postgres_repository/main.rs +++ b/tests/repositories/postgres_repository/mod.rs @@ -1,8 +1,6 @@ //! Postgres-dialect checks. Behaviour every repository shares lives in the //! repository conformance suite (`common::repository`). -#![cfg(feature = "postgres")] - use common::ids::unique_id; use common::postgres::PostgresTestSchema; use common::todo::Todo; diff --git a/tests/postgres_repository_conformance/main.rs b/tests/repositories/postgres_repository_conformance/mod.rs similarity index 79% rename from tests/postgres_repository_conformance/main.rs rename to tests/repositories/postgres_repository_conformance/mod.rs index a047b23d6..33a1c3920 100644 --- a/tests/postgres_repository_conformance/main.rs +++ b/tests/repositories/postgres_repository_conformance/mod.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "postgres")] - common::repository_conformance_tests!( common::repository::Postgres, sql_faults: true, diff --git a/tests/queued_repo/main.rs b/tests/repositories/queued_repo/mod.rs similarity index 99% rename from tests/queued_repo/main.rs rename to tests/repositories/queued_repo/mod.rs index c643d2096..d25306ca0 100644 --- a/tests/queued_repo/main.rs +++ b/tests/repositories/queued_repo/mod.rs @@ -329,7 +329,7 @@ use common::sqlite as sqlite_support; #[cfg(feature = "sqlite")] mod stale_lease { use super::*; - use crate::sqlite_support::TempDb; + use crate::queued_repo::sqlite_support::TempDb; use distributed::{QueuedRepository, RepositoryError, SqliteLockManager}; /// Writer A loads (holds the lease), the lease TTL expires, writer B steals diff --git a/tests/repository_api/main.rs b/tests/repositories/repository_api/mod.rs similarity index 100% rename from tests/repository_api/main.rs rename to tests/repositories/repository_api/mod.rs diff --git a/tests/schedule_worker/main.rs b/tests/repositories/schedule_worker/mod.rs similarity index 92% rename from tests/schedule_worker/main.rs rename to tests/repositories/schedule_worker/mod.rs index 0545dcca6..034d219d8 100644 --- a/tests/schedule_worker/main.rs +++ b/tests/repositories/schedule_worker/mod.rs @@ -1,8 +1,6 @@ //! The schedule worker on the in-memory, SQLite and Postgres repositories //! (see `common::schedule`). Postgres skips without `DATABASE_URL`. -#![cfg(any(feature = "sqlite", feature = "postgres"))] - mod in_memory { common::schedule_conformance_tests!( common::schedule::InMemory, diff --git a/tests/scheduled_outbox/main.rs b/tests/repositories/scheduled_outbox/mod.rs similarity index 100% rename from tests/scheduled_outbox/main.rs rename to tests/repositories/scheduled_outbox/mod.rs diff --git a/tests/snapshot_sqlite_hardening/main.rs b/tests/repositories/snapshot_sqlite_hardening/mod.rs similarity index 99% rename from tests/snapshot_sqlite_hardening/main.rs rename to tests/repositories/snapshot_sqlite_hardening/mod.rs index f53eb0367..d3a3ceef7 100644 --- a/tests/snapshot_sqlite_hardening/main.rs +++ b/tests/repositories/snapshot_sqlite_hardening/mod.rs @@ -13,7 +13,6 @@ //! struct) must NOT be decoded. It is treated as a cache miss and the //! aggregate is rebuilt by full replay to the correct final state — never //! silently wrong. -#![cfg(feature = "sqlite")] use distributed::{ sourced, Aggregate, AggregateBuilder, Entity, Snapshot, SnapshotRecord, SnapshotStore, diff --git a/tests/sql_lock_manager/main.rs b/tests/repositories/sql_lock_manager/mod.rs similarity index 86% rename from tests/sql_lock_manager/main.rs rename to tests/repositories/sql_lock_manager/mod.rs index 9b8bf5afc..69ad64e8e 100644 --- a/tests/sql_lock_manager/main.rs +++ b/tests/repositories/sql_lock_manager/mod.rs @@ -2,8 +2,6 @@ //! `PostgresLockManager` (see `common::lock`). Postgres skips without //! `DATABASE_URL`. -#![cfg(any(feature = "sqlite", feature = "postgres"))] - #[cfg(feature = "sqlite")] mod sqlite { common::lock_conformance_tests!(common::lock::Sqlite); diff --git a/tests/sqlite_repository/main.rs b/tests/repositories/sqlite_repository/mod.rs similarity index 98% rename from tests/sqlite_repository/main.rs rename to tests/repositories/sqlite_repository/mod.rs index 68d89a02e..cca35fcb1 100644 --- a/tests/sqlite_repository/main.rs +++ b/tests/repositories/sqlite_repository/mod.rs @@ -1,8 +1,6 @@ //! SQLite-dialect checks. Behaviour every repository shares lives in the //! repository conformance suite (`common::repository`). -#![cfg(feature = "sqlite")] - use common::todo::Todo; use distributed::table::TableSchemaRegistry; use distributed::{AggregateBuilder, SqliteRepository, OUTBOX_MESSAGES_TABLE}; diff --git a/tests/sqlite_repository_conformance/main.rs b/tests/repositories/sqlite_repository_conformance/mod.rs similarity index 79% rename from tests/sqlite_repository_conformance/main.rs rename to tests/repositories/sqlite_repository_conformance/mod.rs index 7363f8870..e9d5d7f0e 100644 --- a/tests/sqlite_repository_conformance/main.rs +++ b/tests/repositories/sqlite_repository_conformance/mod.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "sqlite")] - common::repository_conformance_tests!( common::repository::Sqlite, sql_faults: true, diff --git a/tests/bomberman/domain/bomb.rs b/tests/services/bomberman/domain/bomb.rs similarity index 100% rename from tests/bomberman/domain/bomb.rs rename to tests/services/bomberman/domain/bomb.rs diff --git a/tests/bomberman/domain/explosion.rs b/tests/services/bomberman/domain/explosion.rs similarity index 100% rename from tests/bomberman/domain/explosion.rs rename to tests/services/bomberman/domain/explosion.rs diff --git a/tests/bomberman/domain/game_map.rs b/tests/services/bomberman/domain/game_map.rs similarity index 100% rename from tests/bomberman/domain/game_map.rs rename to tests/services/bomberman/domain/game_map.rs diff --git a/tests/bomberman/domain/mod.rs b/tests/services/bomberman/domain/mod.rs similarity index 100% rename from tests/bomberman/domain/mod.rs rename to tests/services/bomberman/domain/mod.rs diff --git a/tests/bomberman/domain/player.rs b/tests/services/bomberman/domain/player.rs similarity index 100% rename from tests/bomberman/domain/player.rs rename to tests/services/bomberman/domain/player.rs diff --git a/tests/bomberman/domain/tick_saga.rs b/tests/services/bomberman/domain/tick_saga.rs similarity index 100% rename from tests/bomberman/domain/tick_saga.rs rename to tests/services/bomberman/domain/tick_saga.rs diff --git a/tests/bomberman/domain/types.rs b/tests/services/bomberman/domain/types.rs similarity index 100% rename from tests/bomberman/domain/types.rs rename to tests/services/bomberman/domain/types.rs diff --git a/tests/bomberman/error.rs b/tests/services/bomberman/error.rs similarity index 100% rename from tests/bomberman/error.rs rename to tests/services/bomberman/error.rs diff --git a/tests/bomberman/handlers/create_game.rs b/tests/services/bomberman/handlers/create_game.rs similarity index 82% rename from tests/bomberman/handlers/create_game.rs rename to tests/services/bomberman/handlers/create_game.rs index f48849ba1..5b1541efa 100644 --- a/tests/bomberman/handlers/create_game.rs +++ b/tests/services/bomberman/handlers/create_game.rs @@ -1,9 +1,9 @@ use distributed::{ReadModelWritePlanCommitExt, TransactionalCommit}; use super::shared::board_write_plan; -use crate::domain::game_map::GameMap; -use crate::error::GameError; -use crate::views::BoardView; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::error::GameError; +use crate::bomberman::views::BoardView; pub async fn create_game(repo: &R, game_id: &str, ascii_map: &str) -> Result where diff --git a/tests/bomberman/handlers/get_player.rs b/tests/services/bomberman/handlers/get_player.rs similarity index 78% rename from tests/bomberman/handlers/get_player.rs rename to tests/services/bomberman/handlers/get_player.rs index 81c667c5f..b077b8746 100644 --- a/tests/bomberman/handlers/get_player.rs +++ b/tests/services/bomberman/handlers/get_player.rs @@ -1,8 +1,8 @@ use distributed::GetStream; use super::shared::get_aggregate; -use crate::domain::player::Player; -use crate::error::GameError; +use crate::bomberman::domain::player::Player; +use crate::bomberman::error::GameError; pub async fn get_player(repo: &R, player_id: &str) -> Result { get_aggregate::(repo, &format!("player:{}", player_id)) diff --git a/tests/bomberman/handlers/join_game.rs b/tests/services/bomberman/handlers/join_game.rs similarity index 92% rename from tests/bomberman/handlers/join_game.rs rename to tests/services/bomberman/handlers/join_game.rs index 71c1b0b1b..683a83fab 100644 --- a/tests/bomberman/handlers/join_game.rs +++ b/tests/services/bomberman/handlers/join_game.rs @@ -7,9 +7,9 @@ use super::shared::{ board_write_plan, build_board_from_aggregates, get_aggregate, load_board, load_board_bombs, load_board_explosions, load_board_players, }; -use crate::domain::game_map::GameMap; -use crate::domain::player::Player; -use crate::error::GameError; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::domain::player::Player; +use crate::bomberman::error::GameError; pub async fn join_game( repo: &R, diff --git a/tests/bomberman/handlers/mod.rs b/tests/services/bomberman/handlers/mod.rs similarity index 100% rename from tests/bomberman/handlers/mod.rs rename to tests/services/bomberman/handlers/mod.rs diff --git a/tests/bomberman/handlers/move_player.rs b/tests/services/bomberman/handlers/move_player.rs similarity index 92% rename from tests/bomberman/handlers/move_player.rs rename to tests/services/bomberman/handlers/move_player.rs index 39287d0c6..20da5bbe9 100644 --- a/tests/bomberman/handlers/move_player.rs +++ b/tests/services/bomberman/handlers/move_player.rs @@ -7,10 +7,10 @@ use super::shared::{ board_write_plan, build_board_from_aggregates, get_aggregate, load_board, load_board_bombs, load_board_explosions, load_board_players, }; -use crate::domain::game_map::GameMap; -use crate::domain::player::Player; -use crate::domain::types::Direction; -use crate::error::GameError; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::domain::player::Player; +use crate::bomberman::domain::types::Direction; +use crate::bomberman::error::GameError; pub async fn move_player( repo: &R, diff --git a/tests/bomberman/handlers/place_bomb.rs b/tests/services/bomberman/handlers/place_bomb.rs similarity index 92% rename from tests/bomberman/handlers/place_bomb.rs rename to tests/services/bomberman/handlers/place_bomb.rs index 0075ba4aa..3af21e76c 100644 --- a/tests/bomberman/handlers/place_bomb.rs +++ b/tests/services/bomberman/handlers/place_bomb.rs @@ -7,10 +7,10 @@ use super::shared::{ board_write_plan, build_board_from_aggregates, get_aggregate, load_board, load_board_bombs, load_board_explosions, load_board_players, }; -use crate::domain::bomb::Bomb; -use crate::domain::game_map::GameMap; -use crate::domain::player::Player; -use crate::error::GameError; +use crate::bomberman::domain::bomb::Bomb; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::domain::player::Player; +use crate::bomberman::error::GameError; pub async fn place_bomb(repo: &R, player_id: &str, game_id: &str) -> Result<(), GameError> where diff --git a/tests/bomberman/handlers/shared.rs b/tests/services/bomberman/handlers/shared.rs similarity index 92% rename from tests/bomberman/handlers/shared.rs rename to tests/services/bomberman/handlers/shared.rs index 7c0914c42..d7c982b6f 100644 --- a/tests/bomberman/handlers/shared.rs +++ b/tests/services/bomberman/handlers/shared.rs @@ -4,12 +4,12 @@ use distributed::{ RelationalReadModelQueryStore, RepositoryError, RowKey, RowValue, StreamIdentity, }; -use crate::domain::bomb::Bomb; -use crate::domain::explosion::Explosion; -use crate::domain::game_map::GameMap; -use crate::domain::player::Player; -use crate::error::GameError; -use crate::views::{build_board, BoardView}; +use crate::bomberman::domain::bomb::Bomb; +use crate::bomberman::domain::explosion::Explosion; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::domain::player::Player; +use crate::bomberman::error::GameError; +use crate::bomberman::views::{build_board, BoardView}; pub(crate) fn board_key(game_id: &str) -> RowKey { RowKey::new([("game_id", RowValue::String(game_id.into()))]) diff --git a/tests/bomberman/handlers/tick.rs b/tests/services/bomberman/handlers/tick.rs similarity index 96% rename from tests/bomberman/handlers/tick.rs rename to tests/services/bomberman/handlers/tick.rs index bdbacea76..377e32ade 100644 --- a/tests/bomberman/handlers/tick.rs +++ b/tests/services/bomberman/handlers/tick.rs @@ -8,13 +8,13 @@ use super::shared::{ board_write_plan, build_board_from_aggregates, get_aggregate, load_board, load_board_bombs, load_board_explosions, load_board_players, }; -use crate::domain::bomb::Bomb; -use crate::domain::explosion::Explosion; -use crate::domain::game_map::GameMap; -use crate::domain::player::Player; -use crate::domain::tick_saga::{Detonation, TickSaga}; -use crate::domain::types::{Direction, Tile}; -use crate::error::GameError; +use crate::bomberman::domain::bomb::Bomb; +use crate::bomberman::domain::explosion::Explosion; +use crate::bomberman::domain::game_map::GameMap; +use crate::bomberman::domain::player::Player; +use crate::bomberman::domain::tick_saga::{Detonation, TickSaga}; +use crate::bomberman::domain::types::{Direction, Tile}; +use crate::bomberman::error::GameError; /// Parent shard for a cell host (`PCH-REQ-006` / `PCH-AC-005.1`). /// diff --git a/tests/bomberman/main.rs b/tests/services/bomberman/mod.rs similarity index 100% rename from tests/bomberman/main.rs rename to tests/services/bomberman/mod.rs diff --git a/tests/bomberman/sim.rs b/tests/services/bomberman/sim.rs similarity index 90% rename from tests/bomberman/sim.rs rename to tests/services/bomberman/sim.rs index acdfdcb6b..373d809d4 100644 --- a/tests/bomberman/sim.rs +++ b/tests/services/bomberman/sim.rs @@ -3,12 +3,12 @@ use distributed::{ RepositoryError, RowKey, RowValue, TransactionalCommit, Versioned, }; -use crate::domain::player::Player; -use crate::domain::tick_saga::TickSaga; -use crate::domain::types::Direction; -use crate::error::GameError; -use crate::handlers; -use crate::views::BoardView; +use crate::bomberman::domain::player::Player; +use crate::bomberman::domain::tick_saga::TickSaga; +use crate::bomberman::domain::types::Direction; +use crate::bomberman::error::GameError; +use crate::bomberman::handlers; +use crate::bomberman::views::BoardView; pub struct Game<'a, R> { repo: &'a R, diff --git a/tests/bomberman/views.rs b/tests/services/bomberman/views.rs similarity index 90% rename from tests/bomberman/views.rs rename to tests/services/bomberman/views.rs index 08730b32c..cb0c45eb2 100644 --- a/tests/bomberman/views.rs +++ b/tests/services/bomberman/views.rs @@ -1,7 +1,7 @@ use distributed::ReadModel; use serde::{Deserialize, Serialize}; -use crate::domain::types::Tile; +use crate::bomberman::domain::types::Tile; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct PlayerState { @@ -67,10 +67,10 @@ impl BoardView { pub fn build_board( game_id: &str, - map: &crate::domain::game_map::GameMap, - players: &[&crate::domain::player::Player], - bombs: &[&crate::domain::bomb::Bomb], - explosions: &[&crate::domain::explosion::Explosion], + map: &crate::bomberman::domain::game_map::GameMap, + players: &[&crate::bomberman::domain::player::Player], + bombs: &[&crate::bomberman::domain::bomb::Bomb], + explosions: &[&crate::bomberman::domain::explosion::Explosion], turn: u32, explosions_created: u64, ) -> BoardView { diff --git a/tests/celld/main.rs b/tests/services/celld.rs similarity index 100% rename from tests/celld/main.rs rename to tests/services/celld.rs diff --git a/tests/e2e_ui_celld_nats_profile/main.rs b/tests/services/e2e_ui_celld_nats_profile/mod.rs similarity index 100% rename from tests/e2e_ui_celld_nats_profile/main.rs rename to tests/services/e2e_ui_celld_nats_profile/mod.rs diff --git a/tests/services/main.rs b/tests/services/main.rs new file mode 100644 index 000000000..d933137f5 --- /dev/null +++ b/tests/services/main.rs @@ -0,0 +1,12 @@ +//! Services built on the framework: microsvc, sagas, example domains and the live celld host. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test services ::` runs what `--test ` ran. + +mod bomberman; +mod celld; +mod e2e_ui_celld_nats_profile; +mod microsvc; +mod saga_transfer; +mod sagas; +mod todos; diff --git a/tests/microsvc/basic.rs b/tests/services/microsvc/basic.rs similarity index 97% rename from tests/microsvc/basic.rs rename to tests/services/microsvc/basic.rs index 740018b17..3f4d53970 100644 --- a/tests/microsvc/basic.rs +++ b/tests/services/microsvc/basic.rs @@ -10,8 +10,10 @@ use serde_json::json; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use crate::commands::dispatch; -use crate::models::counter::{Counter, CreateCounter, DecrementCounter, IncrementCounter}; +use crate::microsvc::commands::dispatch; +use crate::microsvc::models::counter::{ + Counter, CreateCounter, DecrementCounter, IncrementCounter, +}; #[derive(Debug, Serialize, distributed::CommandOutput)] struct Created { diff --git a/tests/microsvc/convention.rs b/tests/services/microsvc/convention.rs similarity index 98% rename from tests/microsvc/convention.rs rename to tests/services/microsvc/convention.rs index ba7e5f10e..58b95999e 100644 --- a/tests/microsvc/convention.rs +++ b/tests/services/microsvc/convention.rs @@ -11,9 +11,9 @@ use distributed::microsvc::{CausalDispatchError, Routes, Service}; use distributed::{AggregateBuilder, InMemoryRepository, OutboxStore, Queueable}; use serde_json::json; -use crate::commands::dispatch; -use crate::handlers::{self, user_session}; -use crate::models::counter::Counter; +use crate::microsvc::commands::dispatch; +use crate::microsvc::handlers::{self, user_session}; +use crate::microsvc::models::counter::Counter; // ============================================================================ // Handler convention — register, dispatch, verify diff --git a/tests/microsvc/handlers/counter_create.rs b/tests/services/microsvc/handlers/counter_create.rs similarity index 96% rename from tests/microsvc/handlers/counter_create.rs rename to tests/services/microsvc/handlers/counter_create.rs index 35df555a9..7cd63319f 100644 --- a/tests/microsvc/handlers/counter_create.rs +++ b/tests/services/microsvc/handlers/counter_create.rs @@ -10,7 +10,7 @@ use distributed::microsvc::{CausalCommandContext, HandlerError, TRANSPORT_ROLE}; use serde::{Deserialize, Serialize}; use super::{counter_state_message, USER_ROLE}; -use crate::models::counter::Counter; +use crate::microsvc::models::counter::Counter; pub const COMMAND: &str = "counter.initialize"; diff --git a/tests/microsvc/handlers/counter_increment.rs b/tests/services/microsvc/handlers/counter_increment.rs similarity index 96% rename from tests/microsvc/handlers/counter_increment.rs rename to tests/services/microsvc/handlers/counter_increment.rs index d326b77b0..43583dfb2 100644 --- a/tests/microsvc/handlers/counter_increment.rs +++ b/tests/services/microsvc/handlers/counter_increment.rs @@ -5,7 +5,7 @@ use distributed::microsvc::{CausalCommandContext, HandlerError, TRANSPORT_ROLE}; use serde::{Deserialize, Serialize}; use super::{counter_state_message, USER_ROLE}; -use crate::models::counter::Counter; +use crate::microsvc::models::counter::Counter; pub const COMMAND: &str = "counter.increment"; diff --git a/tests/microsvc/handlers/mod.rs b/tests/services/microsvc/handlers/mod.rs similarity index 96% rename from tests/microsvc/handlers/mod.rs rename to tests/services/microsvc/handlers/mod.rs index f7dfad36b..22d93f9d9 100644 --- a/tests/microsvc/handlers/mod.rs +++ b/tests/services/microsvc/handlers/mod.rs @@ -5,7 +5,7 @@ use distributed::{ }; use serde::Serialize; -use crate::models::counter::Counter; +use crate::microsvc::models::counter::Counter; pub type Repo = AggregateRepository, Counter>; diff --git a/tests/microsvc/handlers/whoami.rs b/tests/services/microsvc/handlers/whoami.rs similarity index 95% rename from tests/microsvc/handlers/whoami.rs rename to tests/services/microsvc/handlers/whoami.rs index fad0845b9..40bbfca33 100644 --- a/tests/microsvc/handlers/whoami.rs +++ b/tests/services/microsvc/handlers/whoami.rs @@ -7,7 +7,7 @@ use distributed::command::{typed_command, PreparedCommand, Succeeded, TypedComma use distributed::microsvc::{CausalCommandContext, HandlerError}; use serde::{Deserialize, Serialize}; -use crate::models::counter::Counter; +use crate::microsvc::models::counter::Counter; pub const COMMAND: &str = "session.identify"; diff --git a/tests/microsvc/main.rs b/tests/services/microsvc/mod.rs similarity index 100% rename from tests/microsvc/main.rs rename to tests/services/microsvc/mod.rs diff --git a/tests/microsvc/models/counter.rs b/tests/services/microsvc/models/counter.rs similarity index 100% rename from tests/microsvc/models/counter.rs rename to tests/services/microsvc/models/counter.rs diff --git a/tests/microsvc/models/mod.rs b/tests/services/microsvc/models/mod.rs similarity index 100% rename from tests/microsvc/models/mod.rs rename to tests/services/microsvc/models/mod.rs diff --git a/tests/microsvc/session.rs b/tests/services/microsvc/session.rs similarity index 98% rename from tests/microsvc/session.rs rename to tests/services/microsvc/session.rs index 6a58c1c1a..52e3e9a5f 100644 --- a/tests/microsvc/session.rs +++ b/tests/services/microsvc/session.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use serde_json::json; use std::collections::HashMap; -use crate::commands::dispatch; +use crate::microsvc::commands::dispatch; #[derive(Debug, Deserialize, distributed::CommandInput)] struct Identify {} diff --git a/tests/microsvc/transport_grpc.rs b/tests/services/microsvc/transport_grpc.rs similarity index 98% rename from tests/microsvc/transport_grpc.rs rename to tests/services/microsvc/transport_grpc.rs index 8bc22d8e9..7777413a7 100644 --- a/tests/microsvc/transport_grpc.rs +++ b/tests/services/microsvc/transport_grpc.rs @@ -13,9 +13,9 @@ use serde_json::json; use tokio::net::TcpListener; use tokio_stream::wrappers::TcpListenerStream; -use crate::commands::command_id; -use crate::handlers; -use crate::models::counter::Counter; +use crate::microsvc::commands::command_id; +use crate::microsvc::handlers; +use crate::microsvc::models::counter::Counter; fn counter_service() -> Arc { Arc::new( diff --git a/tests/microsvc/transport_http.rs b/tests/services/microsvc/transport_http.rs similarity index 98% rename from tests/microsvc/transport_http.rs rename to tests/services/microsvc/transport_http.rs index ab5bdc586..140766f18 100644 --- a/tests/microsvc/transport_http.rs +++ b/tests/services/microsvc/transport_http.rs @@ -8,9 +8,9 @@ use distributed::microsvc::{self, Routes, Service}; use distributed::{AggregateBuilder, InMemoryRepository, Queueable}; use serde_json::json; -use crate::commands::command_id; -use crate::handlers; -use crate::models::counter::Counter; +use crate::microsvc::commands::command_id; +use crate::microsvc::handlers; +use crate::microsvc::models::counter::Counter; fn counter_service() -> Arc { Arc::new( diff --git a/tests/microsvc/transport_listen.rs b/tests/services/microsvc/transport_listen.rs similarity index 98% rename from tests/microsvc/transport_listen.rs rename to tests/services/microsvc/transport_listen.rs index cee8a77bf..04fdaaa00 100644 --- a/tests/microsvc/transport_listen.rs +++ b/tests/services/microsvc/transport_listen.rs @@ -14,9 +14,9 @@ use distributed::microsvc::{Message, MessageKind, Routes, Service, TRANSPORT_ROL use distributed::{AggregateBuilder, InMemoryRepository, Queueable}; use serde_json::json; -use crate::commands::dispatch; -use crate::handlers::{self, user_session}; -use crate::models::counter::Counter; +use crate::microsvc::commands::dispatch; +use crate::microsvc::handlers::{self, user_session}; +use crate::microsvc::models::counter::Counter; fn counter_service(store: InMemoryRepository) -> Arc { Arc::new( diff --git a/tests/microsvc/transport_subscribe.rs b/tests/services/microsvc/transport_subscribe.rs similarity index 95% rename from tests/microsvc/transport_subscribe.rs rename to tests/services/microsvc/transport_subscribe.rs index d929ef7d1..e32d6063f 100644 --- a/tests/microsvc/transport_subscribe.rs +++ b/tests/services/microsvc/transport_subscribe.rs @@ -10,8 +10,8 @@ use distributed::microsvc::{Context, HandlerError, Message, MessageKind, Routes, use distributed::{AggregateBuilder, InMemoryRepository, Queueable}; use serde_json::{json, Value}; -use crate::handlers::{counter_state_message, Repo}; -use crate::models::counter::{Counter, CreateCounter, IncrementCounter}; +use crate::microsvc::handlers::{counter_state_message, Repo}; +use crate::microsvc::models::counter::{Counter, CreateCounter, IncrementCounter}; const INITIALIZE: &str = "counter.initialize"; const INCREMENT: &str = "counter.increment"; diff --git a/tests/saga_transfer/main.rs b/tests/services/saga_transfer/mod.rs similarity index 99% rename from tests/saga_transfer/main.rs rename to tests/services/saga_transfer/mod.rs index ab416e0cc..b5bed0a53 100644 --- a/tests/saga_transfer/main.rs +++ b/tests/services/saga_transfer/mod.rs @@ -675,7 +675,7 @@ async fn saga_aggregate_replays_to_the_same_state() { #[cfg(feature = "sqlite")] #[tokio::test] async fn saga_and_its_timer_survive_restart_on_sqlite() { - use crate::sqlite_support::TempDb; + use crate::saga_transfer::sqlite_support::TempDb; use distributed::{SqliteRepository, SystemClock}; let db = TempDb::new("saga_restart"); diff --git a/tests/sagas/handlers/inventory/init.rs b/tests/services/sagas/handlers/inventory/init.rs similarity index 100% rename from tests/sagas/handlers/inventory/init.rs rename to tests/services/sagas/handlers/inventory/init.rs diff --git a/tests/sagas/handlers/inventory/mod.rs b/tests/services/sagas/handlers/inventory/mod.rs similarity index 88% rename from tests/sagas/handlers/inventory/mod.rs rename to tests/services/sagas/handlers/inventory/mod.rs index 623625530..1a74797ee 100644 --- a/tests/sagas/handlers/inventory/mod.rs +++ b/tests/services/sagas/handlers/inventory/mod.rs @@ -5,7 +5,7 @@ use distributed::microsvc::{CausalCommandContext, HandlerError, TRANSPORT_ROLE}; use serde::Serialize; use super::messages::*; -use crate::order::Inventory; +use crate::sagas::order::Inventory; pub mod init; pub mod reserve; diff --git a/tests/sagas/handlers/inventory/reserve.rs b/tests/services/sagas/handlers/inventory/reserve.rs similarity index 100% rename from tests/sagas/handlers/inventory/reserve.rs rename to tests/services/sagas/handlers/inventory/reserve.rs diff --git a/tests/sagas/handlers/messages.rs b/tests/services/sagas/handlers/messages.rs similarity index 98% rename from tests/sagas/handlers/messages.rs rename to tests/services/sagas/handlers/messages.rs index 04ed8bc3d..6295664ed 100644 --- a/tests/sagas/handlers/messages.rs +++ b/tests/services/sagas/handlers/messages.rs @@ -8,7 +8,7 @@ use distributed::microsvc::HandlerError; use distributed::OutboxMessage; use serde::{Deserialize, Serialize}; -use crate::order::OrderItem; +use crate::sagas::order::OrderItem; /// Create a JSON-serialized outbox message routed to a destination queue. /// diff --git a/tests/sagas/handlers/mod.rs b/tests/services/sagas/handlers/mod.rs similarity index 100% rename from tests/sagas/handlers/mod.rs rename to tests/services/sagas/handlers/mod.rs diff --git a/tests/sagas/handlers/orders/complete.rs b/tests/services/sagas/handlers/orders/complete.rs similarity index 100% rename from tests/sagas/handlers/orders/complete.rs rename to tests/services/sagas/handlers/orders/complete.rs diff --git a/tests/sagas/handlers/orders/create.rs b/tests/services/sagas/handlers/orders/create.rs similarity index 100% rename from tests/sagas/handlers/orders/create.rs rename to tests/services/sagas/handlers/orders/create.rs diff --git a/tests/sagas/handlers/orders/mod.rs b/tests/services/sagas/handlers/orders/mod.rs similarity index 89% rename from tests/sagas/handlers/orders/mod.rs rename to tests/services/sagas/handlers/orders/mod.rs index e6d94f9d5..663664d21 100644 --- a/tests/sagas/handlers/orders/mod.rs +++ b/tests/services/sagas/handlers/orders/mod.rs @@ -5,7 +5,7 @@ use distributed::microsvc::{CausalCommandContext, HandlerError, TRANSPORT_ROLE}; use serde::Serialize; use super::messages::*; -use crate::order::Order; +use crate::sagas::order::Order; pub mod complete; pub mod create; diff --git a/tests/sagas/handlers/payments/mod.rs b/tests/services/sagas/handlers/payments/mod.rs similarity index 88% rename from tests/sagas/handlers/payments/mod.rs rename to tests/services/sagas/handlers/payments/mod.rs index 11821f25f..6fa81a9c2 100644 --- a/tests/sagas/handlers/payments/mod.rs +++ b/tests/services/sagas/handlers/payments/mod.rs @@ -5,6 +5,6 @@ use distributed::microsvc::{CausalCommandContext, HandlerError, TRANSPORT_ROLE}; use serde::Serialize; use super::messages::*; -use crate::order::Payment; +use crate::sagas::order::Payment; pub mod process; diff --git a/tests/sagas/handlers/payments/process.rs b/tests/services/sagas/handlers/payments/process.rs similarity index 100% rename from tests/sagas/handlers/payments/process.rs rename to tests/services/sagas/handlers/payments/process.rs diff --git a/tests/sagas/handlers/saga/mod.rs b/tests/services/sagas/handlers/saga/mod.rs similarity index 93% rename from tests/sagas/handlers/saga/mod.rs rename to tests/services/sagas/handlers/saga/mod.rs index e60dddd90..8d4010169 100644 --- a/tests/sagas/handlers/saga/mod.rs +++ b/tests/services/sagas/handlers/saga/mod.rs @@ -7,7 +7,7 @@ use serde::Serialize; use serde_json::{json, Value}; use super::messages::*; -use crate::order::OrderFulfillmentSaga; +use crate::sagas::order::OrderFulfillmentSaga; pub type Repo = AggregateRepository< QueuedRepository, diff --git a/tests/sagas/handlers/saga/on_inventory_reserved.rs b/tests/services/sagas/handlers/saga/on_inventory_reserved.rs similarity index 100% rename from tests/sagas/handlers/saga/on_inventory_reserved.rs rename to tests/services/sagas/handlers/saga/on_inventory_reserved.rs diff --git a/tests/sagas/handlers/saga/on_order_completed.rs b/tests/services/sagas/handlers/saga/on_order_completed.rs similarity index 100% rename from tests/sagas/handlers/saga/on_order_completed.rs rename to tests/services/sagas/handlers/saga/on_order_completed.rs diff --git a/tests/sagas/handlers/saga/on_order_created.rs b/tests/services/sagas/handlers/saga/on_order_created.rs similarity index 100% rename from tests/sagas/handlers/saga/on_order_created.rs rename to tests/services/sagas/handlers/saga/on_order_created.rs diff --git a/tests/sagas/handlers/saga/on_payment_succeeded.rs b/tests/services/sagas/handlers/saga/on_payment_succeeded.rs similarity index 100% rename from tests/sagas/handlers/saga/on_payment_succeeded.rs rename to tests/services/sagas/handlers/saga/on_payment_succeeded.rs diff --git a/tests/sagas/handlers/saga/start.rs b/tests/services/sagas/handlers/saga/start.rs similarity index 100% rename from tests/sagas/handlers/saga/start.rs rename to tests/services/sagas/handlers/saga/start.rs diff --git a/tests/sagas/microsvc_saga.rs b/tests/services/sagas/microsvc_saga.rs similarity index 100% rename from tests/sagas/microsvc_saga.rs rename to tests/services/sagas/microsvc_saga.rs diff --git a/tests/sagas/main.rs b/tests/services/sagas/mod.rs similarity index 100% rename from tests/sagas/main.rs rename to tests/services/sagas/mod.rs diff --git a/tests/sagas/order/inventory.rs b/tests/services/sagas/order/inventory.rs similarity index 100% rename from tests/sagas/order/inventory.rs rename to tests/services/sagas/order/inventory.rs diff --git a/tests/sagas/order/mod.rs b/tests/services/sagas/order/mod.rs similarity index 100% rename from tests/sagas/order/mod.rs rename to tests/services/sagas/order/mod.rs diff --git a/tests/sagas/order/order_aggregate.rs b/tests/services/sagas/order/order_aggregate.rs similarity index 100% rename from tests/sagas/order/order_aggregate.rs rename to tests/services/sagas/order/order_aggregate.rs diff --git a/tests/sagas/order/payment.rs b/tests/services/sagas/order/payment.rs similarity index 100% rename from tests/sagas/order/payment.rs rename to tests/services/sagas/order/payment.rs diff --git a/tests/sagas/order/saga.rs b/tests/services/sagas/order/saga.rs similarity index 100% rename from tests/sagas/order/saga.rs rename to tests/services/sagas/order/saga.rs diff --git a/tests/todos/main.rs b/tests/services/todos/mod.rs similarity index 100% rename from tests/todos/main.rs rename to tests/services/todos/mod.rs diff --git a/tests/kafka_transport/main.rs b/tests/transports/kafka_transport/mod.rs similarity index 99% rename from tests/kafka_transport/main.rs rename to tests/transports/kafka_transport/mod.rs index f3be42cb9..39a3ce561 100644 --- a/tests/kafka_transport/main.rs +++ b/tests/transports/kafka_transport/mod.rs @@ -3,7 +3,6 @@ //! Publishes via `KafkaPublisher` (acks=all) and consumes via `KafkaSource` //! (consumer group, offset commit on ack) against a broker. Skips when //! `KAFKA_BROKERS` is unset. -#![cfg(feature = "kafka")] use std::sync::{Arc, Mutex}; use std::time::Duration; diff --git a/tests/knative_cloudevents/main.rs b/tests/transports/knative_cloudevents/mod.rs similarity index 99% rename from tests/knative_cloudevents/main.rs rename to tests/transports/knative_cloudevents/mod.rs index 8aca37292..fc5a042e8 100644 --- a/tests/knative_cloudevents/main.rs +++ b/tests/transports/knative_cloudevents/mod.rs @@ -3,7 +3,6 @@ //! Drives `cloud_events_router` over a real ephemeral HTTP server and asserts //! the CloudEvents binding (binary + structured) and the ack/retry/permanent //! response-status mapping. Runs in-process — no external broker. -#![cfg(feature = "knative")] use std::sync::{Arc, Mutex}; diff --git a/tests/transports/main.rs b/tests/transports/main.rs new file mode 100644 index 000000000..03831e053 --- /dev/null +++ b/tests/transports/main.rs @@ -0,0 +1,21 @@ +//! Message transports: in-memory, SQLite, Postgres, NATS, RabbitMQ, Kafka, Redis Streams and Knative. +//! +//! One test binary for the area: each former `tests/` target is a +//! module, so `cargo test --test transports ::` runs what `--test ` ran. + +#[cfg(feature = "kafka")] +mod kafka_transport; +#[cfg(feature = "knative")] +mod knative_cloudevents; +#[cfg(feature = "nats")] +mod nats_transport; +#[cfg(feature = "postgres")] +mod postgres_transport; +#[cfg(feature = "rabbitmq")] +mod rabbitmq_transport; +#[cfg(feature = "redis-streams")] +mod redis_streams; +#[cfg(feature = "sqlite")] +mod sqlite_transport; +mod transport_in_memory; +mod transport_typed_commands; diff --git a/tests/nats_transport/main.rs b/tests/transports/nats_transport/mod.rs similarity index 99% rename from tests/nats_transport/main.rs rename to tests/transports/nats_transport/mod.rs index 3777f2f41..12a3fa2b4 100644 --- a/tests/nats_transport/main.rs +++ b/tests/transports/nats_transport/mod.rs @@ -2,7 +2,6 @@ //! //! Publishes via `NatsPublisher` and consumes via `NatsJetStreamSource` against a //! JetStream-enabled NATS server. Skips when `NATS_URL` is unset. -#![cfg(feature = "nats")] use std::sync::{Arc, Mutex}; use std::time::Duration; diff --git a/tests/postgres_transport/main.rs b/tests/transports/postgres_transport/mod.rs similarity index 99% rename from tests/postgres_transport/main.rs rename to tests/transports/postgres_transport/mod.rs index a516fc33a..52571054d 100644 --- a/tests/postgres_transport/main.rs +++ b/tests/transports/postgres_transport/mod.rs @@ -4,7 +4,6 @@ //! durable transport — against a real Postgres: claim (`FOR UPDATE SKIP LOCKED` //! with a lease), dispatch, and settle by row status. Skips when `DATABASE_URL` //! is unset. -#![cfg(feature = "postgres")] use common::postgres; diff --git a/tests/rabbitmq_transport/main.rs b/tests/transports/rabbitmq_transport/mod.rs similarity index 99% rename from tests/rabbitmq_transport/main.rs rename to tests/transports/rabbitmq_transport/mod.rs index 177627892..0aff25f19 100644 --- a/tests/rabbitmq_transport/main.rs +++ b/tests/transports/rabbitmq_transport/mod.rs @@ -2,7 +2,6 @@ //! //! Publishes via `RabbitPublisher` (publisher confirms) and consumes via //! `RabbitSource` (`basic_get`) against a broker. Skips when `AMQP_URL` is unset. -#![cfg(feature = "rabbitmq")] use std::sync::{Arc, Mutex}; diff --git a/tests/redis_streams/main.rs b/tests/transports/redis_streams/mod.rs similarity index 95% rename from tests/redis_streams/main.rs rename to tests/transports/redis_streams/mod.rs index 8054a9d0e..eda3085fe 100644 --- a/tests/redis_streams/main.rs +++ b/tests/transports/redis_streams/mod.rs @@ -3,8 +3,7 @@ //! Tests that need a server skip (with a logged reason) when `REDIS_URL` is //! unset; the unavailable-server test always runs. //! -//! REDIS_URL=redis://127.0.0.1:6379 cargo test --test redis_streams --features redis-streams -#![cfg(feature = "redis-streams")] +//! REDIS_URL=redis://127.0.0.1:6379 cargo test --test transports --features redis-streams redis_streams:: use distributed::bus::{Message, MessageKind, MessagePublisher, RedisStreamPublisher}; diff --git a/tests/sqlite_transport/main.rs b/tests/transports/sqlite_transport/mod.rs similarity index 99% rename from tests/sqlite_transport/main.rs rename to tests/transports/sqlite_transport/mod.rs index 1b5da58e5..2a5d8f0ed 100644 --- a/tests/sqlite_transport/main.rs +++ b/tests/transports/sqlite_transport/mod.rs @@ -2,7 +2,6 @@ //! //! Exercises `SqliteBus` over a local SQLite file: command work-queue claims, //! event log offsets, retry/nack behavior, and corrupt-row handling. -#![cfg(feature = "sqlite")] // Shared broker-test helpers (recording_for, message fixtures, bus scenarios). use common::sqlite as sqlite_support; diff --git a/tests/transport_in_memory/main.rs b/tests/transports/transport_in_memory/mod.rs similarity index 100% rename from tests/transport_in_memory/main.rs rename to tests/transports/transport_in_memory/mod.rs diff --git a/tests/transport_typed_commands/main.rs b/tests/transports/transport_typed_commands/mod.rs similarity index 100% rename from tests/transport_typed_commands/main.rs rename to tests/transports/transport_typed_commands/mod.rs