Testing

Arona's tests are arranged in layers so that the default cargo test run is fast, hermetic and needs neither a database nor the network, while the heavier suites are explicit opt-ins that exercise the real wire surface and a real PostgreSQL. This page maps the layers, the commands that run them, and the workspace discipline around real-credential smoke runs.

Unit tests

The bulk of the coverage is plain unit tests inside packages/core/src: 217 #[test] / #[tokio::test] functions, plus ~23 more across packages/agent and packages/cli. They run with:

bash
1
cargo test --workspace

No network, no database. Key suites:

Hermetic integration (always-run, DB-free)

packages/core/tests/gateway_integration.rs contains three always-run tests that exercise real serialization/contract logic without touching a database:

packages/core/tests/smoke.rs adds three more always-run tests: hardware detection, the model-registry root path, and config defaults under MOCK_MODE=1.

PG-gated integration

The full in-process gateway suite — packages/core/tests/gateway_integration.rs — spins the complete axum router on a random loopback port, registers disposable OpenAI-compatible mock upstreams through the real admin API, and drives the wire surface with reqwest. Because AuthManager talks to PostgreSQL on every path (even MOCK_MODE=1 only seeds accounts into the database), this suite is gated behind ARONA_TEST_PG=1 and skipped by default. The 10 tests:

Run it with the disposable-Postgres one-liner from the module docs (gateway_integration.rs:18-26):

bash
1
2
3
4
5
6
docker run -d --name arona-it-pg-$$ \
  -e POSTGRES_PASSWORD=it_pw -e POSTGRES_USER=it -e POSTGRES_DB=it \
  -p 127.0.0.1::5432 postgres:15-alpine
# read the mapped host port, then:
DATABASE_URL=postgres://it:it_pw@127.0.0.1:<port>/it \
  ARONA_TEST_PG=1 cargo test -p _core --test gateway_integration -- --ignored

These are example credentials for the disposable test container only — never point this at a real database.

Live-server smoke

packages/core/tests/auth_flow.rs walks the full register → login → keys.create → /v1/models → /v1/chat/completions → usage.list chain against a live Arona server, mirroring the deployed auth loop. It is #[ignore]d by default — the plain cargo test run never touches the network. Run it explicitly:

bash
1
ARONA_TEST_RUN=1 cargo test -p _core --test auth_flow -- --ignored

Knobs:

  1. 1
    Without it the test only asserts auth passed (not 401/403), because the target environment may have no inference provider configured.

The suite also includes negative tests: an unauthenticated chat completion and an unauthenticated GET /v1/models must both be rejected with 401.

Mock server

scripts/mock/server.py is an aiohttp-based OpenAI-compatible fake used by the quickstart and by smoke runs. It serves POST /v1/chat/completions (non-stream and SSE), GET /v1/models, GET /api/health, the JSON-RPC WebSocket/HTTP surface at /api/rpc, an SSE sidecar at /api/rpc/events, and GET /api/test-key, which returns the mock API key so other services can discover it. It listens on port 8429 by default (override with ARONA_MOCK_PORT, host with ARONA_MOCK_HOST). The quickstart uses it to stand up an end-to-end environment without real model providers.

Real-credential smoke discipline

Smoke runs against real providers (DeepSeek / GLM) are deliberately not repository tests — they require real credentials and real money, so they cannot live in CI or in the git tree. The workspace convention, documented in the gateway_integration module docs (gateway_integration.rs:54-55), is:

The mock server is the stand-in for these runs in CI and local development; the real-credential smoke is a release-time human step.

CI

.github/workflows/ci.yml runs cargo fmt, cargo clippy, cargo test --workspace and cargo-deny on the org's self-hosted runners ([self-hosted, linux, x64, local]); ci-hosted.yml mirrors the same checks on GitHub-hosted runners. .github/workflows/docs.yml builds this docs site with lagrange and deploys it to GitHub Pages on pushes touching docs/**.