Engine
Tests
262 test files, 2,889 tests. Where to find them, what they cover, how to run them.
The MAP repo holds 2,889 tests across 262 test files. The engine itself has 716 lines of test in engine/core/src/tests.rs covering the full 8-stage pipeline.
Where tests live
| Path | Test count (approx.) | Coverage |
|---|---|---|
engine/core/src/tests.rs | 716 lines | Pipeline stages, rate limiter, security gate, circuit breaker, load balancer, audit pipeline |
engine/common/tests/ | per-type unit tests | InvokeContext helpers, ResolvedAgentIdentity semantics |
engine/identity/tests/ | resolver tests | Middleware enrichment, ResolveOutcome fallbacks |
engine/recipe/tests/ | DAG validation | Topological sort, cycle detection, confidence propagation |
protocols/*/tests/ | per-protocol unit + integration | 1,500+ tests across all 30 implemented protocols |
services/gateway/tests/ | HTTP ingress | Auth header parsing, trace propagation, error mapping |
services/mcp/tests/ | MCP server | Tool listing, tool execution, stdio + SSE transports |
tests/ (workspace root) | end-to-end | Cross-protocol flows, recipe execution, audit replay |
Running
# Everything
cargo test --workspace --all-features
# Just the engine
cargo test -p map-core
# A specific protocol
cargo test -p mind-lib
# With logs
RUST_LOG=debug cargo test -p map-core -- --nocaptureFeature-gated tests
Some test groups run only under specific features:
# Native adapter (default for prod)
cargo test --features native-adapter
# WASM adapter (excludes tokio rt-multi-thread)
cargo test --features wasm-adapter --no-default-features
# Production storage (postgres + redis)
cargo test --features production-storageKey test groups in engine/core/src/tests.rs
pipeline_stages— each stage in isolation, then in sequencerate_limiter_behavior— token bucket exhaustion, refill, multi-tenant isolationsecurity_gating— hierarchical wildcard matching across all three levelscircuit_breaker— full CLOSED → OPEN → HALF_OPEN cycle with backoffload_balancer_failover— endpoint selection under partial failureaudit_pipeline_async— non-blocking writes, sink failure, disk-backed buffer drainrouter_lru_semantics— cache hit/miss, eviction safety with outstanding invocationserror_mapping—ProtocolError→CoreErrorfor every variant
Property-based tests
The audit chain integrity tests use proptest:
- Inserting N random events and replaying produces an identical chain head
- Concurrent inserts from M tasks produce a consistent chain regardless of ordering
- A truncation followed by replay restores the same chain head
Continuous integration
CI runs:
cargo fmt --checkcargo clippy --workspace --all-features -- -D warnings -W clippy::unwrap_usedcargo test --workspace --all-features --no-fail-fastcargo bench -p mind-lib(regression checks)- WASM build:
cargo build --features wasm-adapter --no-default-features - Docker build of
Dockerfile.mim(sanity check on the deploy variant)
A failing clippy lint blocks merge — particularly clippy::unwrap_used since the codebase forbids unwrap() in production paths.