Repository navigation
Testing
Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker
swift test| Property | Value |
|---|---|
| Tests | 179 |
| Runtime | ~6 seconds |
| External network | not required |
| Warnings | none, from a clean build |
End-to-end tests launch the real executable with a scrubbed environment: PATH plus
their own explicit overrides, with every documented provider variable removed.
Without that scrub, an exported TAVILY_API_KEY — exactly what the installation guide
tells a user to set — would make the stub-provider test contact the live vendor and fail.
This was a real defect, so it is now verified rather than assumed:
TAVILY_API_KEY=tvly-fake BRAVE_SEARCH_API_KEY=brave-fake swift testCI runs the whole suite a second time with credentials present for the same reason.
| File | Covers |
|---|---|
CoreUnitTests |
URL canonicalization, configuration parsing, durations, logging |
FusionAndReliabilityTests |
RRF fusion, deduplication, diversity capping, aggregator weighting, circuit breaker, rate limiter, cache |
URLPolicyTests |
SSRF: schemes, loopback/private/metadata literals, DNS resolution, IP classification |
HTMLExtractorTests |
Readable-text extraction, boilerplate removal, scraper parsing, challenge detection |
HTTPClientTests |
Retry, Retry-After, idempotency, size limits, cancellation, Latin-1 fallback |
ProviderContractTests |
Per-adapter contract and failure taxonomy |
SearchOrchestratorTests |
Selection, fan-out, failover, timeouts, caching, domain filtering |
StdioServerTests |
Real MCP handshake, tool schemas, tool calls, stdout purity |
ErrorReportingTests |
Error attribution, explicit-provider fallback, post-error liveness |
LoopbackServer binds 127.0.0.1 and speaks HTTP/1.1, so retry, Retry-After,
idempotency, size limits and cancellation are verified against real socket behaviour
rather than against a mock that would encode the same assumptions as the client.
Every covered adapter must satisfy the same contract:
| Expectation | Assertion |
|---|---|
| Happy path | Normalized results with valid URLs and ranks |
401 / 403
|
Classified as authentication
|
429 |
Classified as rate_limited, with Retry-After parsed |
5xx |
Classified as transient |
| Malformed body | Clean malformed_response failure, never junk results |
| Cancellation | Stops in-flight work |
| Credentials | Never appear in logs or diagnostics |
Covered: Tavily, Brave, Mojeek, Exa, SearXNG, DuckDuckGo. Gaps are recorded on the Project Tracker.
CircuitBreaker, RateLimiter and SearchCache take an injectable Clock, so cooldown
and expiry tests advance a TestClock instead of sleeping. Timeout tests use short
budgets rather than real waits. Fusion ordering is fully deterministic, so ranking
assertions are stable.
python3 scripts/mcp_smoke.pyA dependency-free client that drives the built binary through a real handshake and asserts that:
-
initializesucceeds and reports the expected server identity; -
tools/listexposes exactly three tools with valid object schemas; -
web_searchwith no provider configured fails as an actionable tool error; - every line written to stdout is valid JSON-RPC;
- diagnostics appear on stderr, never stdout.
It keeps stdin open until all replies have been read, which is what the stdio transport contract requires.
.github/workflows/ci.yml runs on macos-26 (Xcode 26.x, Swift 6.3) for every push and
pull request to main:
swift build --build-testsswift testswift build -c release-
python3 scripts/mcp_smoke.pyagainst the release binary -
swift testagain with provider credentials present, proving hermeticity
The toolchain version is asserted before anything else, because a
swift-tools-version: 6.3 manifest cannot even be parsed by an older Swift.
Automation is not ceremony here: it found three defects that local builds had hidden.
-
macos-14ships Swift 5.10, which cannot parse the manifest. -
Package.swiftdeclared a resource bundle for a directory git does not track, so a clean checkout failed to build while local builds passed. - A trailing-
deferwarning that only a from-scratch build surfaced.
Live provider behaviour is non-deterministic and free tiers are metered, so live smoke tests belong in a scheduled job rather than the unit suite. That is open work on the Project Tracker.
Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker