MAP Docs
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

PathTest count (approx.)Coverage
engine/core/src/tests.rs716 linesPipeline stages, rate limiter, security gate, circuit breaker, load balancer, audit pipeline
engine/common/tests/per-type unit testsInvokeContext helpers, ResolvedAgentIdentity semantics
engine/identity/tests/resolver testsMiddleware enrichment, ResolveOutcome fallbacks
engine/recipe/tests/DAG validationTopological sort, cycle detection, confidence propagation
protocols/*/tests/per-protocol unit + integration1,500+ tests across all 30 implemented protocols
services/gateway/tests/HTTP ingressAuth header parsing, trace propagation, error mapping
services/mcp/tests/MCP serverTool listing, tool execution, stdio + SSE transports
tests/ (workspace root)end-to-endCross-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 -- --nocapture

Feature-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-storage

Key test groups in engine/core/src/tests.rs

  • pipeline_stages — each stage in isolation, then in sequence
  • rate_limiter_behavior — token bucket exhaustion, refill, multi-tenant isolation
  • security_gating — hierarchical wildcard matching across all three levels
  • circuit_breaker — full CLOSED → OPEN → HALF_OPEN cycle with backoff
  • load_balancer_failover — endpoint selection under partial failure
  • audit_pipeline_async — non-blocking writes, sink failure, disk-backed buffer drain
  • router_lru_semantics — cache hit/miss, eviction safety with outstanding invocations
  • error_mappingProtocolErrorCoreError for 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:

  1. cargo fmt --check
  2. cargo clippy --workspace --all-features -- -D warnings -W clippy::unwrap_used
  3. cargo test --workspace --all-features --no-fail-fast
  4. cargo bench -p mind-lib (regression checks)
  5. WASM build: cargo build --features wasm-adapter --no-default-features
  6. 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.

On this page