FerryDocs
ContributingTesting

Unit and API tests

cargo test runs each test that needs no Docker. The run takes seconds.

Edit on GitHub
Terminal
cargo test --workspace
API testReal routerferry-apiStorein memoryMockEnginerecords the calls

An API test sends a request to the real router.

1 / 3

What runs

TestsWhereWhat they do
Unit testsNext to the code, in each crate
API testscrates/ferry-api/tests/The real on a in memory, with a MockEngine in the place of the . They cover each route, authentication, errors, blueprints, webhooks, the change feed and concurrency.
Builder testscrates/ferry-build/tests/build_pipeline.rsFetch, detect, generate, build and cleanup. A fake docker CLI records what it receives.
Proxy and TLS testsThe proxy against local upstreams. The certificate manager through real , with no network.
The OpenAPI checkcrates/ferry-api/tests/openapi.rsOne list of routes must agree with the router, the and src/lib.rs. A new route with no documentation fails here.

A does no real work. Thus these tests run without Docker.

Run fewer tests

Terminal
cargo test -p ferry-api                       # one crate
cargo test -p ferry-api --test blueprints     # one test file
cargo test -p ferry-core env::                # tests whose name matches

On this page