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.
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:
- Check the gate first. Without
FERRY_E2E=1, printskippedand return. - Use your own name prefix, such as
ferrytest-<crate>-<random>. Also use free ports and a temporary data directory. - 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 drop guard.
- Use small base images only:
python:3.12-alpine,node:22-alpine,nginx:alpine,busybox:stable,postgres:16-alpine,redis:7-alpine. - Use the example apps in
examples/as fixtures.
Deploy an example "from git"
Copy the example to a temporary directory. Then run this command there:
git init && git add -A && git commitIf a run leaves containers
A run that stops in the middle can leave containers. Remove them by prefix:
docker ps -aq --filter label=ferry.instance=<prefix> | xargs docker rm -f