Testing

contextd includes unit, doctest, integration, MCP end-to-end, benchmark, and memory-stress suites.

Test Suites

SuiteCommandCoverage
Unit & Library Testscargo test --lib --bins --lockedConfig & trust isolation, Tree-sitter/PDF chunking & UTF-8 budgets, safe_read (O_NOFOLLOW), ignore/secret exclusions, external parser plugins, SQLite WAL/sqlite-vec/FTS5 hybrid search, HTTP API security middleware, MCP server, connect, download
Doc Testscargo test --doc --lockedCrate-level embedded library quickstart in src/lib.rs
Integration Testscargo test --tests --lockedwatcher_test (file events/renames/deletes), load_test (concurrent HTTP API + rapid edits), zero_config_test (model cache & setup)
Embedded Examplecargo run --example embedded_searchOffline Tree-sitter + SQLite WAL hybrid search library usage
MCP E2E SuiteCONTEXTD_BIN=./target/debug/contextd python3 scripts/test_mcp_local.py17 end-to-end JSON-RPC 2.0 / MCP protocol, validation, cancellation, and edge-case checks
Memory Stresspython3 scripts/memory_stress_test.pyLarge corpus (10K files, 1K queries) memory-bound check
Benchmarkscargo bench --locked / bash scripts/bench.shCriterion benchmarks (chunker_bench, db_bench)

Running the Full Verification Suite

# Formatting, lints, and rustdoc
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --locked

# All Rust tests (unit, doc, integration)
cargo test --locked

# Offline embedded example
cargo run --example embedded_search

# MCP end-to-end tests
CONTEXTD_BIN=./target/debug/contextd python3 scripts/test_mcp_local.py

# Shell script syntax checks
bash -n scripts/install.sh scripts/playground.sh scripts/pdftotext.sh