FerryDocs
ContributingTesting

Write an end-to-end test

Tests of different crates share one Docker daemon. Each test keeps its resources apart and removes them at the end.

Edit on GitHub
One Docker daemonTest of crate Aits own prefixTest of crate Bits own prefixferrytest-a-…containersferrytest-b-…containers

Tests of different crates run at the same time against the same daemon.

1 / 3

The five rules

Each test that needs Docker must obey these rules:

  1. Check the gate first. Without FERRY_E2E=1, print skipped and return.
  2. Use your own name prefix, such as ferrytest-<crate>-<random>. Also use free ports and a temporary data directory.
  3. Remove all that the test creates, also after a failure: containers, volumes, the network, and the images with its prefix. The suites that exist do it with a .
  4. Use small base images only: python:3.12-alpine, node:22-alpine, nginx:alpine, busybox:stable, postgres:16-alpine, redis:7-alpine.
  5. Use the example apps in examples/ as .

Deploy an example "from git"

Copy the example to a temporary directory. Then run this command there:

Terminal
git init && git add -A && git commit

If a run leaves containers

A run that stops in the middle can leave containers. Remove them by prefix:

Terminal
docker ps -aq --filter label=ferry.instance=<prefix> | xargs docker rm -f

On this page